diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml index 41e4303d4378c..a9dda36594109 100755 --- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml +++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle.xml @@ -60,7 +60,12 @@ page at http://checkstyle.sourceforge.net/config.html --> - + + + + + + diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java index 26840826d978c..1d751432d7420 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClientBuilder.java @@ -3,6 +3,7 @@ package com.azure.data.appconfiguration; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.implementation.annotation.ServiceClientBuilder; import com.azure.core.util.logging.ClientLogger; import com.azure.data.appconfiguration.credentials.ConfigurationClientCredentials; @@ -165,7 +166,7 @@ public ConfigurationAsyncClient buildAsyncClient() { HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogDetailLevel)); - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); diff --git a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationClientJavaDocCodeSnippets.java b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationClientJavaDocCodeSnippets.java index b82ee17274582..95841f7199621 100644 --- a/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationClientJavaDocCodeSnippets.java +++ b/sdk/appconfiguration/azure-data-appconfiguration/src/samples/java/com/azure/data/appconfiguration/ConfigurationClientJavaDocCodeSnippets.java @@ -4,6 +4,7 @@ package com.azure.data.appconfiguration; import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.rest.Response; import com.azure.core.test.models.RecordedData; import com.azure.core.test.policy.RecordNetworkCallPolicy; @@ -34,7 +35,7 @@ public ConfigurationClient createAsyncConfigurationClientWithPipeline() { String connectionString = getConnectionString(); // BEGIN: com.azure.data.applicationconfig.configurationclient.pipeline.instantiation RecordedData networkData = new RecordedData(); - HttpPipeline pipeline = HttpPipeline.builder().policies(new RecordNetworkCallPolicy(networkData)).build(); + HttpPipeline pipeline = new HttpPipelineBuilder().policies(new RecordNetworkCallPolicy(networkData)).build(); ConfigurationClient configurationClient = new ConfigurationClientBuilder() .pipeline(pipeline) diff --git a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureProxy.java b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureProxy.java index a60817b69fdda..d892d00ce7189 100644 --- a/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureProxy.java +++ b/sdk/core/azure-core-management/src/main/java/com/azure/core/management/implementation/AzureProxy.java @@ -8,6 +8,7 @@ import com.azure.core.http.HttpMethod; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpResponse; import com.azure.core.http.policy.CookiePolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -189,7 +190,7 @@ public static HttpPipeline createDefaultPipeline(Class swaggerInterface, Http policies.add(credentialsPolicy); } - return HttpPipeline.builder() + return new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .build(); } diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyTests.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyTests.java index 8e6e63c015b66..c61f36a953b20 100644 --- a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyTests.java +++ b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/AzureProxyToRestProxyTests.java @@ -3,6 +3,7 @@ package com.azure.core.management; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.implementation.annotation.BodyParam; import com.azure.core.implementation.annotation.Delete; import com.azure.core.implementation.annotation.ExpectedResponses; @@ -764,7 +765,7 @@ public void service18GetStatus500WithExpectedResponse500() { } private T createService(Class serviceClass) { - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(createHttpClient()) .build(); // diff --git a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/AzureProxyTests.java b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/AzureProxyTests.java index 7f1de50865f5a..05adb15d5994a 100644 --- a/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/AzureProxyTests.java +++ b/sdk/core/azure-core-management/src/test/java/com/azure/core/management/implementation/AzureProxyTests.java @@ -3,6 +3,7 @@ package com.azure.core.management.implementation; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.implementation.annotation.Delete; import com.azure.core.implementation.annotation.ExpectedResponses; import com.azure.core.implementation.annotation.Get; @@ -851,7 +852,7 @@ public Mono send(HttpRequest request) { } private static T createMockService(Class serviceClass, MockAzureHttpClient httpClient) { - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .httpClient(httpClient) .build(); diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeaders.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeaders.java index e39bdd33b2483..ee0ad8cfdb57b 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeaders.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpHeaders.java @@ -3,12 +3,6 @@ package com.azure.core.http; -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.JsonSerializable; -import com.fasterxml.jackson.databind.SerializerProvider; -import com.fasterxml.jackson.databind.jsontype.TypeSerializer; - -import java.io.IOException; import java.util.HashMap; import java.util.Iterator; import java.util.Locale; @@ -17,7 +11,7 @@ /** * A collection of headers on an HTTP request or response. */ -public class HttpHeaders implements Iterable, JsonSerializable { +public class HttpHeaders implements Iterable { private final Map headers = new HashMap<>(); /** @@ -128,14 +122,4 @@ public Map toMap() { public Iterator iterator() { return headers.values().iterator(); } - - @Override - public void serialize(JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { - jsonGenerator.writeObject(toMap()); - } - - @Override - public void serializeWithType(JsonGenerator jsonGenerator, SerializerProvider serializerProvider, TypeSerializer typeSerializer) throws IOException { - serialize(jsonGenerator, serializerProvider); - } } diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipeline.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipeline.java index 7ee93824740a7..c0ae2db65d2e4 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipeline.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipeline.java @@ -18,15 +18,6 @@ public final class HttpPipeline { private final HttpPipelinePolicy[] pipelinePolicies; - /** - * Creates a builder that can configure options for the HttpPipeline before creating an instance of it. - * - * @return A new {@link HttpPipelineBuilder} to create a HttpPipeline from. - */ - public static HttpPipelineBuilder builder() { - return new HttpPipelineBuilder(); - } - /** * Creates a HttpPipeline holding array of policies that gets applied to all request initiated through * {@link HttpPipeline#send(HttpPipelineCallContext)} and it's response. diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipelineBuilder.java b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipelineBuilder.java index 14f7f6ab53e52..ce1abec97bda4 100644 --- a/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipelineBuilder.java +++ b/sdk/core/azure-core/src/main/java/com/azure/core/http/HttpPipelineBuilder.java @@ -21,14 +21,14 @@ *

Create a pipeline without configuration

* *
- * HttpPipeline.builder()
+ * new HttpPipelineBuilder()
  *     .build();
  * 
* *

Create a pipeline using the default HTTP client and a retry policy

* *
- * HttpPipeline.builder()
+ * new HttpPipelineBuilder()
  *     .httpClient(HttpClient.createDefault())
  *     .policies(new RetryPolicy())
  *     .build();
@@ -41,7 +41,12 @@ public class HttpPipelineBuilder {
     private List pipelinePolicies;
 
 
-    HttpPipelineBuilder() {
+    /**
+     -     * Creates a builder that can configure options for the HttpPipeline before creating an instance of it.
+     -     *
+     -     * @return A new {@link HttpPipelineBuilder} to create a HttpPipeline from.
+     */
+    public HttpPipelineBuilder() {
     }
 
     /**
diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/RestProxy.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/RestProxy.java
index d61885ce272b3..107a3c410b24f 100644
--- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/RestProxy.java
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/RestProxy.java
@@ -11,6 +11,7 @@
 import com.azure.core.http.HttpMethod;
 import com.azure.core.http.HttpPipeline;
 import com.azure.core.http.HttpRequest;
+import com.azure.core.http.HttpPipelineBuilder;
 import com.azure.core.http.HttpResponse;
 import com.azure.core.http.policy.CookiePolicy;
 import com.azure.core.http.policy.HttpPipelinePolicy;
@@ -624,7 +625,7 @@ public static HttpPipeline createDefaultPipeline(HttpPipelinePolicy credentialsP
             policies.add(credentialsPolicy);
         }
 
-        return HttpPipeline.builder()
+        return new HttpPipelineBuilder()
             .policies(policies.toArray(new HttpPipelinePolicy[0]))
             .build();
     }
diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/HttpHeadersSerializer.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/HttpHeadersSerializer.java
new file mode 100644
index 0000000000000..4174330878b02
--- /dev/null
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/HttpHeadersSerializer.java
@@ -0,0 +1,35 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.azure.core.implementation.serializer.jackson;
+
+import com.azure.core.http.HttpHeaders;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.JsonSerializer;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
+import com.fasterxml.jackson.databind.module.SimpleModule;
+
+import java.io.IOException;
+
+/**
+ * Custom serializer for serializing {@code HttpHeaders} objects into Base64 strings.
+ */
+final class HttpHeadersSerializer extends JsonSerializer {
+    /**
+     * Gets a module wrapping this serializer as an adapter for the Jackson
+     * ObjectMapper.
+     *
+     * @return a simple module to be plugged onto Jackson ObjectMapper.
+     */
+    public static SimpleModule getModule() {
+        SimpleModule module = new SimpleModule();
+        module.addSerializer(HttpHeaders.class, new HttpHeadersSerializer());
+        return module;
+    }
+
+    @Override
+    public void serialize(HttpHeaders value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
+        jgen.writeObject(value.toMap());
+    }
+}
diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/JacksonAdapter.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/JacksonAdapter.java
index c5a0a8c8fd382..c8fa542aa34e3 100644
--- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/JacksonAdapter.java
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/serializer/jackson/JacksonAdapter.java
@@ -170,7 +170,8 @@ private static  T initializeObjectMapper(T mapper) {
                 .registerModule(Base64UrlSerializer.getModule())
                 .registerModule(DateTimeSerializer.getModule())
                 .registerModule(DateTimeRfc1123Serializer.getModule())
-                .registerModule(DurationSerializer.getModule());
+                .registerModule(DurationSerializer.getModule())
+                .registerModule(HttpHeadersSerializer.getModule());
         mapper.setVisibility(mapper.getSerializationConfig().getDefaultVisibilityChecker()
                 .withFieldVisibility(JsonAutoDetect.Visibility.ANY)
                 .withSetterVisibility(JsonAutoDetect.Visibility.NONE)
diff --git a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/FluxUtil.java b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/FluxUtil.java
index c13d5b9bee023..032fed01998b7 100644
--- a/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/FluxUtil.java
+++ b/sdk/core/azure-core/src/main/java/com/azure/core/implementation/util/FluxUtil.java
@@ -3,6 +3,7 @@
 
 package com.azure.core.implementation.util;
 
+import com.azure.core.http.rest.Response;
 import com.azure.core.util.Context;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufAllocator;
@@ -199,6 +200,16 @@ public static  Mono withContext(Function> serviceCall) {
             .flatMap(serviceCall);
     }
 
+    /**
+     * Converts the incoming content to Mono.
+     *
+     * @param response whose {@link Response#value() value} is to be converted
+     * @return The converted {@link Mono}
+     */
+    public static  Mono toMono(Response response) {
+        return Mono.justOrEmpty(response.value());
+    }
+
     /**
      * This method converts the incoming {@code subscriberContext} from {@link reactor.util.context.Context Reactor
      * Context} to {@link Context Azure Context} and calls the given lambda function with this context and returns a
diff --git a/sdk/core/azure-core/src/samples/java/com/azure/core/implementation/util/FluxUtilJavaDocCodeSnippets.java b/sdk/core/azure-core/src/samples/java/com/azure/core/implementation/util/FluxUtilJavaDocCodeSnippets.java
index d09272ddb377e..3c21660a27020 100644
--- a/sdk/core/azure-core/src/samples/java/com/azure/core/implementation/util/FluxUtilJavaDocCodeSnippets.java
+++ b/sdk/core/azure-core/src/samples/java/com/azure/core/implementation/util/FluxUtilJavaDocCodeSnippets.java
@@ -3,6 +3,9 @@
 
 package com.azure.core.implementation.util;
 
+import com.azure.core.http.HttpHeaders;
+import com.azure.core.http.HttpRequest;
+import com.azure.core.http.rest.Response;
 import com.azure.core.util.Context;
 import reactor.core.publisher.Flux;
 import reactor.core.publisher.Mono;
@@ -54,4 +57,33 @@ private Mono serviceCallReturnsSingle(String prefix, Context context) {
         return Mono.empty();
     }
 
+    /**
+     * Implementation not provided
+     * @param value The value
+     * @return A {@link Mono} containing a {@link Response} containing a {@link Response#value() value}.
+     */
+    private  Mono> getMonoRestResponse(T value) {
+        Response response = new Response() {
+            @Override
+            public int statusCode() {
+                return 200;
+            }
+
+            @Override
+            public HttpHeaders headers() {
+                return null;
+            }
+
+            @Override
+            public HttpRequest request() {
+                return null;
+            }
+
+            @Override
+            public T value() {
+                return value;
+            }
+        };
+        return Mono.just(response);
+    }
 }
diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/UserAgentTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/UserAgentTests.java
index 404631e808c43..c97baf2b59ad7 100644
--- a/sdk/core/azure-core/src/test/java/com/azure/core/UserAgentTests.java
+++ b/sdk/core/azure-core/src/test/java/com/azure/core/UserAgentTests.java
@@ -6,6 +6,7 @@
 import com.azure.core.http.HttpMethod;
 import com.azure.core.http.HttpPipeline;
 import com.azure.core.http.HttpRequest;
+import com.azure.core.http.HttpPipelineBuilder;
 import com.azure.core.http.HttpResponse;
 import com.azure.core.http.MockHttpClient;
 import com.azure.core.http.MockHttpResponse;
@@ -19,7 +20,7 @@
 public class UserAgentTests {
     @Test
     public void defaultUserAgentTests() throws Exception {
-        final HttpPipeline pipeline = HttpPipeline.builder()
+        final HttpPipeline pipeline = new HttpPipelineBuilder()
             .httpClient(new MockHttpClient() {
                 @Override
                 public Mono send(HttpRequest request) {
@@ -40,7 +41,7 @@ public Mono send(HttpRequest request) {
 
     @Test
     public void customUserAgentTests() throws Exception {
-        final HttpPipeline pipeline = HttpPipeline.builder()
+        final HttpPipeline pipeline = new HttpPipelineBuilder()
             .httpClient(new MockHttpClient() {
                 @Override
                 public Mono send(HttpRequest request) {
diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/credentials/CredentialsTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/credentials/CredentialsTests.java
index 2362bf9d5b993..581042362bc4e 100644
--- a/sdk/core/azure-core/src/test/java/com/azure/core/credentials/CredentialsTests.java
+++ b/sdk/core/azure-core/src/test/java/com/azure/core/credentials/CredentialsTests.java
@@ -5,6 +5,7 @@
 
 import com.azure.core.http.HttpMethod;
 import com.azure.core.http.HttpPipeline;
+import com.azure.core.http.HttpPipelineBuilder;
 import com.azure.core.http.HttpRequest;
 import com.azure.core.http.MockHttpClient;
 import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
@@ -28,7 +29,7 @@ public void basicCredentialsTest() throws Exception {
             return next.process();
         };
         //
-        final HttpPipeline pipeline = HttpPipeline.builder()
+        final HttpPipeline pipeline = new HttpPipelineBuilder()
             .httpClient(new MockHttpClient())
             .policies((context, next) -> credentials.getToken("scope./default")
                 .flatMap(token -> {
@@ -56,7 +57,7 @@ public Mono getToken(String... scopes) {
             return next.process();
         };
 
-        final HttpPipeline pipeline = HttpPipeline.builder()
+        final HttpPipeline pipeline = new HttpPipelineBuilder()
             .httpClient(new MockHttpClient())
             .policies(new BearerTokenAuthenticationPolicy(credentials, "scope./default"), auditorPolicy)
             .build();
diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpPipelineTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpPipelineTests.java
index 07f2e164317e3..fc4d59e79685c 100644
--- a/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpPipelineTests.java
+++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/HttpPipelineTests.java
@@ -23,7 +23,7 @@
 public class HttpPipelineTests {
     @Test
     public void constructorWithNoArguments() {
-        HttpPipeline pipeline = HttpPipeline.builder().build();
+        HttpPipeline pipeline = new HttpPipelineBuilder().build();
         assertEquals(0, pipeline.getPolicyCount());
         assertNotNull(pipeline.httpClient());
         assertTrue(pipeline.httpClient() instanceof ReactorNettyClient);
@@ -31,7 +31,7 @@ public void constructorWithNoArguments() {
 
     @Test
     public void withRequestPolicy() {
-        HttpPipeline pipeline = HttpPipeline.builder()
+        HttpPipeline pipeline = new HttpPipelineBuilder()
             .policies(new PortPolicy(80, true),
                 new ProtocolPolicy("ftp", true),
                 new RetryPolicy())
@@ -47,7 +47,7 @@ public void withRequestPolicy() {
 
     @Test
     public void withRequestOptions() throws MalformedURLException {
-        HttpPipeline pipeline = HttpPipeline.builder()
+        HttpPipeline pipeline = new HttpPipelineBuilder()
             .policies(new PortPolicy(80, true),
                 new ProtocolPolicy("ftp", true),
                 new RetryPolicy())
@@ -63,7 +63,7 @@ public void withRequestOptions() throws MalformedURLException {
     public void withNoRequestPolicies() throws MalformedURLException {
         final HttpMethod expectedHttpMethod = HttpMethod.GET;
         final URL expectedUrl = new URL("http://my.site.com");
-        final HttpPipeline httpPipeline = HttpPipeline.builder()
+        final HttpPipeline httpPipeline = new HttpPipelineBuilder()
             .httpClient(new MockHttpClient() {
                 @Override
                 public Mono send(HttpRequest request) {
@@ -96,7 +96,7 @@ public Mono send(HttpRequest request) {
             }
         };
 
-        final HttpPipeline httpPipeline = HttpPipeline.builder()
+        final HttpPipeline httpPipeline = new HttpPipelineBuilder()
             .httpClient(httpClient)
             .policies(new UserAgentPolicy(expectedUserAgent))
             .build();
@@ -110,7 +110,7 @@ public Mono send(HttpRequest request) {
     public void withRequestIdRequestPolicy() throws MalformedURLException {
         final HttpMethod expectedHttpMethod = HttpMethod.GET;
         final URL expectedUrl = new URL("http://my.site.com/1");
-        final HttpPipeline httpPipeline = HttpPipeline.builder()
+        final HttpPipeline httpPipeline = new HttpPipelineBuilder()
             .httpClient(new MockHttpClient() {
                 @Override
                 public Mono send(HttpRequest request) {
diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HostPolicyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HostPolicyTests.java
index 8c209c4817c1f..beb4a130ad97a 100644
--- a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HostPolicyTests.java
+++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/HostPolicyTests.java
@@ -7,6 +7,7 @@
 import com.azure.core.http.HttpMethod;
 import com.azure.core.http.HttpPipeline;
 import com.azure.core.http.HttpRequest;
+import com.azure.core.http.HttpPipelineBuilder;
 import com.azure.core.http.HttpResponse;
 import com.azure.core.http.ProxyOptions;
 import org.junit.Test;
@@ -32,7 +33,7 @@ public void withPort() throws MalformedURLException {
     }
 
     private static HttpPipeline createPipeline(String host, String expectedUrl) {
-        return HttpPipeline.builder()
+        return new HttpPipelineBuilder()
             .httpClient(new MockHttpClient())
             .policies(new HostPolicy(host),
                 (context, next) -> {
diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProtocolPolicyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProtocolPolicyTests.java
index c581c598b71ae..3701b984d40d8 100644
--- a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProtocolPolicyTests.java
+++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProtocolPolicyTests.java
@@ -7,6 +7,7 @@
 import com.azure.core.http.HttpMethod;
 import com.azure.core.http.HttpPipeline;
 import com.azure.core.http.HttpRequest;
+import com.azure.core.http.HttpPipelineBuilder;
 import com.azure.core.http.HttpResponse;
 import com.azure.core.http.ProxyOptions;
 import org.junit.Test;
@@ -32,7 +33,7 @@ public void withNoOverwrite() throws MalformedURLException {
         pipeline.send(createHttpRequest("https://www.bing.com"));
     }
     private static HttpPipeline createPipeline(String protocol, String expectedUrl) {
-        return HttpPipeline.builder()
+        return new HttpPipelineBuilder()
             .httpClient(new MockHttpClient())
             .policies(new ProtocolPolicy(protocol, true),
                 (context, next) -> {
@@ -43,7 +44,7 @@ private static HttpPipeline createPipeline(String protocol, String expectedUrl)
     }
 
     private static HttpPipeline createPipeline(String protocol, boolean overwrite, String expectedUrl) {
-        return HttpPipeline.builder()
+        return new HttpPipelineBuilder()
             .httpClient(new MockHttpClient())
             .policies(new ProtocolPolicy(protocol, overwrite),
                 (context, next) -> {
diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProxyAuthenticationPolicyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProxyAuthenticationPolicyTests.java
index 2832ab41e820f..7c0331086ae0f 100644
--- a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProxyAuthenticationPolicyTests.java
+++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/ProxyAuthenticationPolicyTests.java
@@ -5,6 +5,7 @@
 
 import com.azure.core.http.HttpMethod;
 import com.azure.core.http.HttpPipeline;
+import com.azure.core.http.HttpPipelineBuilder;
 import com.azure.core.http.HttpRequest;
 import com.azure.core.http.MockHttpClient;
 import org.junit.Test;
@@ -23,7 +24,7 @@ public void test() throws MalformedURLException {
         final String username = "testuser";
         final String password = "testpass";
         //
-        final HttpPipeline pipeline = HttpPipeline.builder()
+        final HttpPipeline pipeline = new HttpPipelineBuilder()
             .httpClient(new MockHttpClient())
             .policies(new ProxyAuthenticationPolicy(username, password),
                 (context, next) -> {
diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RequestIdPolicyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RequestIdPolicyTests.java
index e044f7d1ea5b6..035a0ded64c83 100644
--- a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RequestIdPolicyTests.java
+++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RequestIdPolicyTests.java
@@ -7,6 +7,7 @@
 import com.azure.core.http.HttpMethod;
 import com.azure.core.http.HttpPipeline;
 import com.azure.core.http.HttpRequest;
+import com.azure.core.http.HttpPipelineBuilder;
 import com.azure.core.http.HttpResponse;
 import com.azure.core.http.MockHttpClient;
 import io.netty.buffer.ByteBuf;
@@ -62,7 +63,7 @@ public Mono bodyAsString(Charset charset) {
 
     @Test
     public void newRequestIdForEachCall() throws Exception {
-        HttpPipeline pipeline = HttpPipeline.builder()
+        HttpPipeline pipeline = new HttpPipelineBuilder()
             .httpClient(new MockHttpClient() {
                 String firstRequestId = null;
                 @Override
@@ -89,7 +90,7 @@ public Mono send(HttpRequest request) {
 
     @Test
     public void sameRequestIdForRetry() throws Exception {
-        final HttpPipeline pipeline = HttpPipeline.builder()
+        final HttpPipeline pipeline = new HttpPipelineBuilder()
             .httpClient(new MockHttpClient() {
                 String firstRequestId = null;
 
diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RetryPolicyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RetryPolicyTests.java
index 7a20532fa07c0..03eb57f79fb6b 100644
--- a/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RetryPolicyTests.java
+++ b/sdk/core/azure-core/src/test/java/com/azure/core/http/policy/RetryPolicyTests.java
@@ -6,6 +6,7 @@
 import com.azure.core.http.HttpMethod;
 import com.azure.core.http.HttpPipeline;
 import com.azure.core.http.HttpRequest;
+import com.azure.core.http.HttpPipelineBuilder;
 import com.azure.core.http.HttpResponse;
 import com.azure.core.http.MockHttpClient;
 import com.azure.core.http.MockHttpResponse;
@@ -20,7 +21,7 @@
 public class RetryPolicyTests {
     @Test
     public void exponentialRetryEndOn501() throws Exception {
-        final HttpPipeline pipeline = HttpPipeline.builder()
+        final HttpPipeline pipeline = new HttpPipelineBuilder()
             .httpClient(new MockHttpClient() {
                 // Send 408, 500, 502, all retried, with a 501 ending
                 private final int[] codes = new int[]{408, 500, 502, 501};
@@ -43,7 +44,7 @@ public Mono send(HttpRequest request) {
     @Test
     public void exponentialRetryMax() throws Exception {
         final int maxRetries = 5;
-        final HttpPipeline pipeline = HttpPipeline.builder()
+        final HttpPipeline pipeline = new HttpPipelineBuilder()
             .httpClient(new MockHttpClient() {
                 int count = -1;
 
diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyStressTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyStressTests.java
index c5aea3ac2a0f6..a8a7258c419fa 100644
--- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyStressTests.java
+++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyStressTests.java
@@ -14,7 +14,7 @@
 import com.azure.core.implementation.annotation.PathParam;
 import com.azure.core.exception.HttpResponseException;
 import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpPipeline;
+import com.azure.core.http.HttpPipelineBuilder;
 import com.azure.core.http.HttpPipelineCallContext;
 import com.azure.core.http.HttpPipelineNextPolicy;
 import com.azure.core.http.HttpResponse;
@@ -108,7 +108,7 @@ public static void beforeClass() throws IOException {
         polices.add(new HttpLoggingPolicy(HttpLogDetailLevel.BASIC, false));
         //
         service = RestProxy.create(IOService.class,
-            HttpPipeline.builder()
+            new HttpPipelineBuilder()
                 .policies(polices.toArray(new HttpPipelinePolicy[0]))
                 .build());
 
@@ -506,7 +506,7 @@ public void testHighParallelism() {
         }
 
         final IOService innerService = RestProxy.create(IOService.class,
-            HttpPipeline.builder()
+            new HttpPipelineBuilder()
                 .policies(policies.toArray(new HttpPipelinePolicy[0]))
                 .build());
 
diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyTests.java
index 2afd1cdd5768a..36137bf7e2051 100644
--- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyTests.java
+++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyTests.java
@@ -4,6 +4,7 @@
 package com.azure.core.implementation;
 
 import com.azure.core.MyRestException;
+import com.azure.core.http.HttpPipelineBuilder;
 import com.azure.core.implementation.annotation.BodyParam;
 import com.azure.core.implementation.annotation.Delete;
 import com.azure.core.implementation.annotation.ExpectedResponses;
@@ -1526,7 +1527,7 @@ public void flowableUploadTest() throws Exception {
         //
         // Order in which policies applied will be the order in which they added to builder
         //
-        final HttpPipeline httpPipeline = HttpPipeline.builder()
+        final HttpPipeline httpPipeline = new HttpPipelineBuilder()
             .httpClient(httpClient)
             .policies(new HttpLoggingPolicy(HttpLogDetailLevel.BODY_AND_HEADERS, true))
             .build();
@@ -1611,14 +1612,14 @@ interface Service25 {
     @Test(expected = HttpResponseException.class)
     @Ignore("Decoding is not a policy anymore")
     public void testMissingDecodingPolicyCausesException() {
-        Service25 service = RestProxy.create(Service25.class, HttpPipeline.builder().build());
+        Service25 service = RestProxy.create(Service25.class, new HttpPipelineBuilder().build());
         service.get();
     }
 
     @Test(expected = HttpResponseException.class)
     @Ignore("Decoding is not a policy anymore")
     public void testSingleMissingDecodingPolicyCausesException() {
-        Service25 service = RestProxy.create(Service25.class, HttpPipeline.builder().build());
+        Service25 service = RestProxy.create(Service25.class, new HttpPipelineBuilder().build());
         service.getAsync().block();
         service.getBodyResponseAsync().block();
     }
@@ -1626,7 +1627,7 @@ public void testSingleMissingDecodingPolicyCausesException() {
     @Test(expected = HttpResponseException.class)
     @Ignore("Decoding is not a policy anymore")
     public void testSingleBodyResponseMissingDecodingPolicyCausesException() {
-        Service25 service = RestProxy.create(Service25.class, HttpPipeline.builder().build());
+        Service25 service = RestProxy.create(Service25.class, new HttpPipelineBuilder().build());
         service.getBodyResponseAsync().block();
     }
 
@@ -1639,7 +1640,7 @@ interface Service26 {
 
     @Test
     public void postUrlFormEncoded() {
-        Service26 service = RestProxy.create(Service26.class, HttpPipeline.builder().build());
+        Service26 service = RestProxy.create(Service26.class, new HttpPipelineBuilder().build());
         HttpBinFormDataJSON response = service.postForm("Foo", "123", "foo@bar.com", PizzaSize.LARGE, Arrays.asList("Bacon", "Onion"));
         assertNotNull(response);
         assertNotNull(response.form());
@@ -1660,7 +1661,7 @@ protected  T createService(Class serviceClass) {
     }
 
     protected  T createService(Class serviceClass, HttpClient httpClient) {
-        final HttpPipeline httpPipeline = HttpPipeline.builder()
+        final HttpPipeline httpPipeline = new HttpPipelineBuilder()
             .httpClient(httpClient)
             .build();
 
diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithMockTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithMockTests.java
index ccbdace926087..32ae6b6789fb5 100644
--- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithMockTests.java
+++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyWithMockTests.java
@@ -15,7 +15,7 @@
 import com.azure.core.exception.HttpResponseException;
 import com.azure.core.http.HttpClient;
 import com.azure.core.http.HttpHeaders;
-import com.azure.core.http.HttpPipeline;
+import com.azure.core.http.HttpPipelineBuilder;
 import com.azure.core.http.HttpRequest;
 import com.azure.core.http.HttpResponse;
 import com.azure.core.http.MockHttpClient;
@@ -179,7 +179,7 @@ interface ServiceErrorWithCharsetService {
     public void serviceErrorWithResponseContentType() {
         ServiceErrorWithCharsetService service = RestProxy.create(
                 ServiceErrorWithCharsetService.class,
-                HttpPipeline.builder().httpClient(new SimpleMockHttpClient() {
+                new HttpPipelineBuilder().httpClient(new SimpleMockHttpClient() {
                     @Override
                     public Mono send(HttpRequest request) {
                         HttpHeaders headers = new HttpHeaders().put("Content-Type", "application/json");
@@ -202,7 +202,7 @@ public Mono send(HttpRequest request) {
     public void serviceErrorWithResponseContentTypeBadJSON() {
         ServiceErrorWithCharsetService service = RestProxy.create(
                 ServiceErrorWithCharsetService.class,
-                HttpPipeline.builder().httpClient(new SimpleMockHttpClient() {
+                new HttpPipelineBuilder().httpClient(new SimpleMockHttpClient() {
                     @Override
                     public Mono send(HttpRequest request) {
                         HttpHeaders headers = new HttpHeaders().put("Content-Type", "application/json");
@@ -225,7 +225,7 @@ public Mono send(HttpRequest request) {
     public void serviceErrorWithResponseContentTypeCharset() {
         ServiceErrorWithCharsetService service = RestProxy.create(
                 ServiceErrorWithCharsetService.class,
-                HttpPipeline.builder().httpClient(new SimpleMockHttpClient() {
+                new HttpPipelineBuilder().httpClient(new SimpleMockHttpClient() {
                     @Override
                     public Mono send(HttpRequest request) {
                         HttpHeaders headers = new HttpHeaders().put("Content-Type", "application/json; charset=UTF-8");
@@ -248,7 +248,7 @@ public Mono send(HttpRequest request) {
     public void serviceErrorWithResponseContentTypeCharsetBadJSON() {
         ServiceErrorWithCharsetService service = RestProxy.create(
                 ServiceErrorWithCharsetService.class,
-                HttpPipeline.builder().httpClient(new SimpleMockHttpClient() {
+                new HttpPipelineBuilder().httpClient(new SimpleMockHttpClient() {
                     @Override
                     public Mono send(HttpRequest request) {
                         HttpHeaders headers = new HttpHeaders().put("Content-Type", "application/json; charset=UTF-8");
diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyXMLTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyXMLTests.java
index 7ea7c05e50ed7..b533a6ff9103f 100644
--- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyXMLTests.java
+++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/RestProxyXMLTests.java
@@ -16,6 +16,7 @@
 import com.azure.core.http.HttpHeaders;
 import com.azure.core.http.HttpMethod;
 import com.azure.core.http.HttpPipeline;
+import com.azure.core.http.HttpPipelineBuilder;
 import com.azure.core.http.HttpRequest;
 import com.azure.core.http.HttpResponse;
 import com.azure.core.http.MockHttpResponse;
@@ -96,7 +97,7 @@ interface MyXMLService {
     @Test
     public void canReadXMLResponse() throws Exception {
         //
-        final HttpPipeline pipeline = HttpPipeline.builder()
+        final HttpPipeline pipeline = new HttpPipelineBuilder()
             .httpClient(new MockXMLHTTPClient())
             .build();
 
@@ -162,7 +163,7 @@ public void canWriteXMLRequest() throws Exception {
         JacksonAdapter serializer = new JacksonAdapter();
         MockXMLReceiverClient httpClient = new MockXMLReceiverClient();
         //
-        final HttpPipeline pipeline = HttpPipeline.builder()
+        final HttpPipeline pipeline = new HttpPipelineBuilder()
             .httpClient(httpClient)
             .build();
         //
@@ -199,7 +200,7 @@ public interface MyXMLServiceWithAttributes {
     public void canDeserializeXMLWithAttributes() throws Exception {
         JacksonAdapter serializer = new JacksonAdapter();
         //
-        final HttpPipeline pipeline = HttpPipeline.builder()
+        final HttpPipeline pipeline = new HttpPipelineBuilder()
             .httpClient(new MockXMLHTTPClient())
             .build();
 
diff --git a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/util/FluxUtilTests.java b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/util/FluxUtilTests.java
index 50a427fc25b54..3ebeb7544b147 100644
--- a/sdk/core/azure-core/src/test/java/com/azure/core/implementation/util/FluxUtilTests.java
+++ b/sdk/core/azure-core/src/test/java/com/azure/core/implementation/util/FluxUtilTests.java
@@ -12,6 +12,7 @@
 import com.azure.core.http.HttpRequest;
 import com.azure.core.http.rest.PagedFlux;
 import com.azure.core.http.rest.PagedResponse;
+import com.azure.core.http.rest.Response;
 import com.azure.core.implementation.http.PagedResponseBase;
 import com.azure.core.util.Context;
 import io.netty.buffer.ByteBuf;
@@ -278,6 +279,13 @@ public void testCollectByteBufStream() {
             0, 0, 1, 0}, bytes);
     }
 
+    @Test
+    public void testToMono() {
+        String value = "test";
+        Assert.assertEquals(getMonoRestResponse(value).flatMap(FluxUtil::toMono).block(), value);
+        Assert.assertEquals(getMonoRestResponse("").flatMap(FluxUtil::toMono).block(), "");
+    }
+
     @Test
     public void testCallWithContextGetSingle() {
         String response = getSingle("Hello, ")
@@ -401,4 +409,29 @@ private File createFileIfNotExist(String fileName) throws IOException {
         return file;
     }
 
+    private  Mono> getMonoRestResponse(T value) {
+        Response response = new Response() {
+            @Override
+            public int statusCode() {
+                return 200;
+            }
+
+            @Override
+            public HttpHeaders headers() {
+                return null;
+            }
+
+            @Override
+            public HttpRequest request() {
+                return null;
+            }
+
+            @Override
+            public T value() {
+                return value;
+            }
+        };
+        return Mono.just(response);
+    }
+
 }
diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyAsyncClient.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyAsyncClient.java
index 1a43375dc288b..49aa98f54e3fb 100644
--- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyAsyncClient.java
+++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyAsyncClient.java
@@ -16,6 +16,7 @@
 import com.azure.core.implementation.annotation.ReturnType;
 import com.azure.core.implementation.annotation.ServiceClient;
 import com.azure.core.implementation.annotation.ServiceMethod;
+import com.azure.core.implementation.util.FluxUtil;
 import com.azure.core.util.Context;
 import com.azure.core.util.logging.ClientLogger;
 import com.azure.security.keyvault.keys.models.DeletedKey;
@@ -85,20 +86,41 @@ public final class KeyAsyncClient {
      *
      * 

Code Samples

*

Creates a new EC key. Subscribes to the call asynchronously and prints out the newly created key details when a response has been received.

- *
-     * keyAsyncClient.createKey("keyName", KeyType.EC).subscribe(keyResponse ->
-     *   System.out.printf("Key is created with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
-     * 
+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createKey#string-keyType} * * @param name The name of the key being created. * @param keyType The type of key to create. For valid values, see {@link KeyType KeyType}. * @throws ResourceModifiedException if {@code name} or {@code keyType} is null. * @throws HttpRequestException if {@code name} is empty string. + * @return A {@link Mono} containing the {@link Key created key}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createKey(String name, KeyType keyType) { + return withContext(context -> createKey(name, keyType, context)) + .flatMap(FluxUtil::toMono); + } + + /** + * Creates a new key and stores it in the key vault. The create key operation can be used to create any key type in + * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * + *

The {@link KeyType keyType} indicates the type of key to create. Possible values include: {@link KeyType#EC EC}, + * {@link KeyType#EC_HSM EC-HSM}, {@link KeyType#RSA RSA}, {@link KeyType#RSA_HSM RSA-HSM} and {@link KeyType#OCT OCT}.

+ * + *

Code Samples

+ *

Creates a new EC key. Subscribes to the call asynchronously and prints out the newly created key details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createKeyWithResponse#keyCreateOptions} + * + * @param keyCreateOptions The key configuration object containing information about the key being created. + * @throws ResourceModifiedException if {@code name} or {@code keyType} is null. + * @throws HttpRequestException if {@code name} is empty string. * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link Key created key}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createKey(String name, KeyType keyType) { - return withContext(context -> createKey(name, keyType, context)); + public Mono> createKeyWithResponse(KeyCreateOptions keyCreateOptions) { + return withContext(context -> createKey(keyCreateOptions, context)); } Mono> createKey(String name, KeyType keyType, Context context) { @@ -122,24 +144,19 @@ Mono> createKey(String name, KeyType keyType, Context context) { *

Code Samples

*

Creates a new Rsa key which activates in one day and expires in one year. Subscribes to the call asynchronously * and prints out the newly created key details when a response has been received.

- *
-     * KeyCreateOptions keyCreateOptions = new KeyCreateOptions("keyName", KeyType.RSA)
-     *    .notBefore(OffsetDateTime.now().plusDays(1))
-     *    .expires(OffsetDateTime.now().plusYears(1));
      *
-     * keyAsyncClient.createKey(keyCreateOptions).subscribe(keyResponse ->
-     *   System.out.printf("Key is created with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
-     * 
+ * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createKey#keyCreateOptions} * * @param keyCreateOptions The key configuration object containing information about the key being created. * @throws NullPointerException if {@code keyCreateOptions} is {@code null}. * @throws ResourceModifiedException if {@code keyCreateOptions} is malformed. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link Key created key}. + * @return A {@link Mono} containing the {@link Key created key}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createKey(KeyCreateOptions keyCreateOptions) { - return withContext(context -> createKey(keyCreateOptions, context)); + public Mono createKey(KeyCreateOptions keyCreateOptions) { + return withContext(context -> createKeyWithResponse(keyCreateOptions)) + .flatMap(FluxUtil::toMono); } Mono> createKey(KeyCreateOptions keyCreateOptions, Context context) { @@ -154,7 +171,6 @@ Mono> createKey(KeyCreateOptions keyCreateOptions, Context context .doOnError(error -> logger.warning("Failed to create key - {}", keyCreateOptions.name(), error)); } - /** * Creates a new Rsa key and stores it in the key vault. The create Rsa key operation can be used to create any Rsa key type in * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. @@ -169,15 +185,33 @@ Mono> createKey(KeyCreateOptions keyCreateOptions, Context context *

Code Samples

*

Creates a new RSA key with size 2048 which activates in one day and expires in one year. Subscribes to the call asynchronously * and prints out the newly created key details when a response has been received.

- *
-     * RsaKeyCreateOptions rsaKeyCreateOptions = new RsaKeyCreateOptions("keyName", KeyType.RSA)
-     *    .keySize(2048)
-     *    .notBefore(OffsetDateTime.now().plusDays(1))
-     *    .expires(OffsetDateTime.now().plusYears(1));
      *
-     * keyAsyncClient.createRsaKey(rsaKeyCreateOptions).subscribe(keyResponse ->
-     *   System.out.printf("RSA Key is created with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
-     * 
+ * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createRsaKey#RsaKeyCreateOptions} + * + * @param rsaKeyCreateOptions The key configuration object containing information about the rsa key being created. + * @throws NullPointerException if {@code rsaKeyCreateOptions} is {@code null}. + * @throws ResourceModifiedException if {@code rsaKeyCreateOptions} is malformed. + * @throws HttpRequestException if {@code name} is empty string. + * @return A {@link Mono} containing the {@link Key created key}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createRsaKey(RsaKeyCreateOptions rsaKeyCreateOptions) { + return withContext(context -> createRsaKeyWithResponse(rsaKeyCreateOptions)) + .flatMap(FluxUtil::toMono); + } + + /** + * Creates a new Rsa key and stores it in the key vault. The create Rsa key operation can be used to create any Rsa key type in + * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * + *

The {@link RsaKeyCreateOptions} is required. The {@link RsaKeyCreateOptions#keySize() keySize} can be optionally specified. The {@link RsaKeyCreateOptions#expires() expires} + * and {@link RsaKeyCreateOptions#notBefore() notBefore} values are optional. The {@link RsaKeyCreateOptions#enabled() enabled} field + * is set to true by Azure Key Vault, if not specified.

+ * + *

The {@link RsaKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: {@link KeyType#RSA RSA} and + * {@link KeyType#RSA_HSM RSA-HSM}.

+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createRsaKeyWithResponse#RsaKeyCreateOptions} * * @param rsaKeyCreateOptions The key configuration object containing information about the rsa key being created. * @throws NullPointerException if {@code rsaKeyCreateOptions} is {@code null}. @@ -186,7 +220,7 @@ Mono> createKey(KeyCreateOptions keyCreateOptions, Context context * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link Key created key}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createRsaKey(RsaKeyCreateOptions rsaKeyCreateOptions) { + public Mono> createRsaKeyWithResponse(RsaKeyCreateOptions rsaKeyCreateOptions) { return withContext(context -> createRsaKey(rsaKeyCreateOptions, context)); } @@ -217,15 +251,37 @@ Mono> createRsaKey(RsaKeyCreateOptions rsaKeyCreateOptions, Contex *

Code Samples

*

Creates a new EC key with P-384 web key curve. The key activates in one day and expires in one year. Subscribes to the call asynchronously * and prints out the newly created ec key details when a response has been received.

- *
-     * EcKeyCreateOptions ecKeyCreateOptions = new EcKeyCreateOptions("keyName", KeyType.EC)
-     *    .curve(KeyCurveName.P_384)
-     *    .notBefore(OffsetDateTime.now().plusDays(1))
-     *    .expires(OffsetDateTime.now().plusYears(1));
      *
-     * keyAsyncClient.createEcKey(ecKeyCreateOptions).subscribe(keyResponse ->
-     *   System.out.printf("EC Key is created with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
-     * 
+ * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createEcKey#EcKeyCreateOptions} + * + * @param ecKeyCreateOptions The key options object containing information about the ec key being created. + * @throws NullPointerException if {@code ecKeyCreateOptions} is {@code null}. + * @throws ResourceModifiedException if {@code ecKeyCreateOptions} is malformed. + * @throws HttpRequestException if {@code name} is empty string. + * @return A {@link Mono} containing the {@link Key created key}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createEcKey(EcKeyCreateOptions ecKeyCreateOptions) { + return withContext(context -> createEcKeyWithResponse(ecKeyCreateOptions)) + .flatMap(FluxUtil::toMono); + } + + /** + * Creates a new Ec key and stores it in the key vault. The create Ec key operation can be used to create any Ec key type in + * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * + *

The {@link EcKeyCreateOptions} parameter is required. The {@link EcKeyCreateOptions#curve() key curve} can be optionally specified. If not specified, + * default value of {@link KeyCurveName#P_256 P-256} is used by Azure Key Vault. The {@link EcKeyCreateOptions#expires() expires} and {@link EcKeyCreateOptions#notBefore() notBefore} values + * are optional. The {@link EcKeyCreateOptions#enabled() enabled} field is set to true by Azure Key Vault, if not specified.

+ * + *

The {@link EcKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: {@link KeyType#EC EC} and + * {@link KeyType#EC_HSM EC-HSM}.

+ * + *

Code Samples

+ *

Creates a new EC key with P-384 web key curve. The key activates in one day and expires in one year. Subscribes to the call asynchronously + * and prints out the newly created ec key details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.createEcKeyWithResponse#EcKeyCreateOptions} * * @param ecKeyCreateOptions The key options object containing information about the ec key being created. * @throws NullPointerException if {@code ecKeyCreateOptions} is {@code null}. @@ -234,7 +290,7 @@ Mono> createRsaKey(RsaKeyCreateOptions rsaKeyCreateOptions, Contex * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link Key created key}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createEcKey(EcKeyCreateOptions ecKeyCreateOptions) { + public Mono> createEcKeyWithResponse(EcKeyCreateOptions ecKeyCreateOptions) { return withContext(context -> createEcKey(ecKeyCreateOptions, context)); } @@ -269,8 +325,9 @@ Mono> createEcKey(EcKeyCreateOptions ecKeyCreateOptions, Context c * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link Key imported key}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> importKey(String name, JsonWebKey keyMaterial) { - return withContext(context -> importKey(name, keyMaterial, context)); + public Mono importKey(String name, JsonWebKey keyMaterial) { + return withContext(context -> importKey(name, keyMaterial, context)) + .flatMap(FluxUtil::toMono); } Mono> importKey(String name, JsonWebKey keyMaterial, Context context) { @@ -281,6 +338,38 @@ Mono> importKey(String name, JsonWebKey keyMaterial, Context conte .doOnError(error -> logger.warning("Failed to import key - {}", name, error)); } + /** + * Imports an externally created key and stores it in key vault. The import key operation may be used to import any key type + * into the Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the {@code keys/import} permission. + * + *

The {@code keyImportOptions} is required and its fields {@link KeyImportOptions#name() name} and {@link KeyImportOptions#keyMaterial() key material} cannot + * be null. The {@link KeyImportOptions#expires() expires} and {@link KeyImportOptions#notBefore() notBefore} values in {@code keyImportOptions} + * are optional. If not specified, no values are set for the fields. The {@link KeyImportOptions#enabled() enabled} field is set to true and + * the {@link KeyImportOptions#hsm() hsm} field is set to false by Azure Key Vault, if they are not specified.

+ * + *

Code Samples

+ *

Imports a new key into key vault. Subscribes to the call asynchronously and prints out the newly imported key details + * when a response has been received.

+ *
+     * KeyImportOptions keyImportOptions = new KeyImportOptions("keyName", jsonWebKeyToImport)
+     *   .hsm(true)
+     *   .expires(OffsetDateTime.now().plusDays(60));
+     *
+     * keyAsyncClient.importKey(keyImportOptions).subscribe(keyResponse ->
+     *   System.out.printf("Key is imported with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
+     * 
+ * + * @param keyImportOptions The key import configuration object containing information about the json web key being imported. + * @throws NullPointerException if {@code keyImportOptions} is {@code null}. + * @throws HttpRequestException if {@code name} is empty string. + * @return A {@link Mono} containing the {@link Key imported key}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono importKey(KeyImportOptions keyImportOptions) { + return withContext(context -> importKeyWithResponse(keyImportOptions)) + .flatMap(FluxUtil::toMono); + } + /** * Imports an externally created key and stores it in key vault. The import key operation may be used to import any key type * into the Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the {@code keys/import} permission. @@ -308,7 +397,7 @@ Mono> importKey(String name, JsonWebKey keyMaterial, Context conte * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link Key imported key}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> importKey(KeyImportOptions keyImportOptions) { + public Mono> importKeyWithResponse(KeyImportOptions keyImportOptions) { return withContext(context -> importKey(keyImportOptions, context)); } @@ -330,12 +419,33 @@ Mono> importKey(KeyImportOptions keyImportOptions, Context context *

Code Samples

*

Gets a specific version of the key in the key vault. Subscribes to the call asynchronously and prints out the * returned key details when a response has been received.

- *
-     * String keyVersion = "6A385B124DEF4096AF1361A85B16C204";
-     * keyAsyncClient.getKey("keyName", keyVersion).subscribe(keyResponse ->
-     *   System.out.printf("Key returned with name %s, id %s and version %s", keyResponse.value().name(),
-     *   keyResponse.value().id(), keyResponse.value().version()));
-     * 
+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.getKey#string-string} + * + * @param name The name of the key, cannot be null + * @param version The version of the key to retrieve. If this is an empty String or null, this call is equivalent to calling {@link KeyAsyncClient#getKey(String)}, with the latest version being retrieved. + * @throws ResourceNotFoundException when a key with {@code name} and {@code version} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} or {@code version} is empty string. + * @return A {@link Mono} containing the requested {@link Key key}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getKey(String name, String version) { + if (version == null) { + return getKeyWithResponse(name) + .flatMap(FluxUtil::toMono); + } + return withContext(context -> getKeyWithResponse(name, version)) + .flatMap(FluxUtil::toMono); + } + + /** + * Gets the public part of the specified key and key version. The get key operation is applicable to all key types and it requires the {@code keys/get} permission. + * + *

Code Samples

+ *

Gets a specific version of the key in the key vault. Subscribes to the call asynchronously and prints out the + * returned key details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#string-string} * * @param name The name of the key, cannot be null * @param version The version of the key to retrieve. If this is an empty String or null, this call is equivalent to calling {@link KeyAsyncClient#getKey(String)}, with the latest version being retrieved. @@ -344,9 +454,9 @@ Mono> importKey(KeyImportOptions keyImportOptions, Context context * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the requested {@link Key key}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getKey(String name, String version) { + public Mono> getKeyWithResponse(String name, String version) { if (version == null) { - return getKey(name); + return getKeyWithResponse(name); } return withContext(context -> getKey(name, version, context)); } @@ -365,11 +475,29 @@ Mono> getKey(String name, String version, Context context) { *

Code Samples

*

Gets latest version of the key in the key vault. Subscribes to the call asynchronously and prints out the * returned key details when a response has been received.

- *
-     * keyAsyncClient.getKey("keyName").subscribe(keyResponse ->
-     *   System.out.printf("Key with name %s, id %s \n", keyResponse.value().name(),
-     *   keyResponse.value().id()));
-     * 
+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.getKey#string} + * + * @param name The name of the key. + * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} is empty string. + * @return A {@link Mono} containing the requested {@link Key key}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getKey(String name) { + return getKeyWithResponse(name, "") + .flatMap(FluxUtil::toMono); + } + + /** + * Get the public part of the latest version of the specified key from the key vault. The get key operation is applicable to + * all key types and it requires the {@code keys/get} permission. + * + *

Code Samples

+ *

Gets latest version of the key in the key vault. Subscribes to the call asynchronously and prints out the + * returned key details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#string} * * @param name The name of the key. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. @@ -377,8 +505,8 @@ Mono> getKey(String name, String version, Context context) { * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the requested {@link Key key}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getKey(String name) { - return getKey(name, ""); + public Mono> getKeyWithResponse(String name) { + return getKeyWithResponse(name, ""); } /** @@ -388,11 +516,34 @@ public Mono> getKey(String name) { *

The list operations {@link KeyAsyncClient#listKeys()} and {@link KeyAsyncClient#listKeyVersions(String)} return * the {@link Flux} containing {@link KeyBase base key} as output excluding the key material of the key. * This operation can then be used to get the full key with its key material from {@code keyBase}.

- *
-     * keyAsyncClient.listKeys().subscribe(keyBase ->
-     *     client.getKey(keyBase).subscribe(keyResponse ->
-     *       System.out.printf("Key with name %s and value %s \n", keyResponse.value().name(), keyResponse.value().id())));
-     * 
+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.getKey#KeyBase} + * + * @param keyBase The {@link KeyBase base key} holding attributes of the key being requested. + * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link KeyBase#name()} name} or {@link KeyBase#version() version} is empty string. + * @return A {@link Mono} containing the requested {@link Key key}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getKey(KeyBase keyBase) { + Objects.requireNonNull(keyBase, "The Key Base parameter cannot be null."); + if (keyBase.version() == null) { + return getKeyWithResponse(keyBase.name()) + .flatMap(FluxUtil::toMono); + } + return getKeyWithResponse(keyBase.name(), keyBase.version()) + .flatMap(FluxUtil::toMono); + } + + /** + * Get public part of the key which represents {@link KeyBase keyBase} from the key vault. The get key operation is applicable + * to all key types and it requires the {@code keys/get} permission. + * + *

The list operations {@link KeyAsyncClient#listKeys()} and {@link KeyAsyncClient#listKeyVersions(String)} return + * the {@link Flux} containing {@link KeyBase base key} as output excluding the key material of the key. + * This operation can then be used to get the full key with its key material from {@code keyBase}.

+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#KeyBase} * * @param keyBase The {@link KeyBase base key} holding attributes of the key being requested. * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. @@ -400,12 +551,12 @@ public Mono> getKey(String name) { * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the requested {@link Key key}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getKey(KeyBase keyBase) { + public Mono> getKeyWithResponse(KeyBase keyBase) { Objects.requireNonNull(keyBase, "The Key Base parameter cannot be null."); if (keyBase.version() == null) { - return getKey(keyBase.name()); + return getKeyWithResponse(keyBase.name()); } - return getKey(keyBase.name(), keyBase.version()); + return getKeyWithResponse(keyBase.name(), keyBase.version()); } /** @@ -416,15 +567,31 @@ public Mono> getKey(KeyBase keyBase) { *

Code Samples

*

Gets latest version of the key, changes its notBefore time and then updates it in the Azure Key Vault. Subscribes to the call asynchronously and prints out the * returned key details when a response has been received.

- *
-     * keyAsyncClient.getKey("keyName").subscribe(keyResponse -> {
-     *     Key key = keyResponse.value();
-     *     //Update the not before time of the key.
-     *     key.notBefore(OffsetDateTime.now().plusDays(50));
-     *     keyAsyncClient.updateKey(key).subscribe(updatedKeyResponse ->
-     *         System.out.printf("Key's updated not before time %s \n", updatedKeyResponse.value().notBefore().toString()));
-     *   });
-     * 
+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.updateKey#KeyBase} + * + * @param key The {@link KeyBase base key} object with updated properties. + * @throws NullPointerException if {@code key} is {@code null}. + * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link KeyBase#name() name} or {@link KeyBase#version() version} is empty string. + * @return A {@link Mono} containing the {@link KeyBase updated key}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateKey(KeyBase key) { + return withContext(context -> updateKeyWithResponse(key)) + .flatMap(FluxUtil::toMono); + } + + /** + * Updates the attributes associated with the specified key, but not the cryptographic key material of the specified key in the key vault. The update + * operation changes specified attributes of an existing stored key and attributes that are not specified in the request are left unchanged. + * The cryptographic key material of a key itself cannot be changed. This operation requires the {@code keys/set} permission. + * + *

Code Samples

+ *

Gets latest version of the key, changes its notBefore time and then updates it in the Azure Key Vault. Subscribes to the call asynchronously and prints out the + * returned key details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.updateKeyWithResponse#KeyBase} * * @param key The {@link KeyBase base key} object with updated properties. * @throws NullPointerException if {@code key} is {@code null}. @@ -433,7 +600,7 @@ public Mono> getKey(KeyBase keyBase) { * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link KeyBase updated key}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateKey(KeyBase key) { + public Mono> updateKeyWithResponse(KeyBase key) { return withContext(context -> updateKey(key, context)); } @@ -448,7 +615,6 @@ Mono> updateKey(KeyBase key, Context context) { .doOnError(error -> logger.warning("Failed to update key - {}", key.name(), error)); } - /** * Updates the attributes and key operations associated with the specified key, but not the cryptographic key material of the specified key in the key vault. The update * operation changes specified attributes of an existing stored key and attributes that are not specified in the request are left unchanged. @@ -457,15 +623,8 @@ Mono> updateKey(KeyBase key, Context context) { *

Code Samples

*

Gets latest version of the key, changes its notBefore time and then updates it in the Azure Key Vault. Subscribes to the call asynchronously and prints out the * returned key details when a response has been received.

- *
-     * keyAsyncClient.getKey("keyName").subscribe(keyResponse -> {
-     *     Key key = keyResponse.value();
-     *     //Update the not before time of the key and associate Encrypt and Decrypt operations with it.
-     *     key.notBefore(OffsetDateTime.now().plusDays(50));
-     *     keyAsyncClient.updateKey(key, KeyOperation.ENCRYPT, KeyOperation.DECRYPT).subscribe(updatedKeyResponse ->
-     *         System.out.printf("Key's updated not before time %s \n", updatedKeyResponse.value().notBefore().toString()));
-     *   });
-     * 
+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.updateKeyWithResponse#KeyBase-keyOperations} * * @param key The {@link KeyBase base key} object with updated properties. * @param keyOperations The updated key operations to associate with the key. @@ -475,10 +634,34 @@ Mono> updateKey(KeyBase key, Context context) { * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link KeyBase updated key}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> updateKey(KeyBase key, KeyOperation... keyOperations) { + public Mono> updateKeyWithResponse(KeyBase key, KeyOperation... keyOperations) { return withContext(context -> updateKey(key, context, keyOperations)); } + /** + * Updates the attributes and key operations associated with the specified key, but not the cryptographic key material of the specified key in the key vault. The update + * operation changes specified attributes of an existing stored key and attributes that are not specified in the request are left unchanged. + * The cryptographic key material of a key itself cannot be changed. This operation requires the {@code keys/set} permission. + * + *

Code Samples

+ *

Gets latest version of the key, changes its notBefore time and then updates it in the Azure Key Vault. Subscribes to the call asynchronously and prints out the + * returned key details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.updateKey#KeyBase-keyOperations} + * + * @param key The {@link KeyBase base key} object with updated properties. + * @param keyOperations The updated key operations to associate with the key. + * @throws NullPointerException if {@code key} is {@code null}. + * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link KeyBase#name() name} or {@link KeyBase#version() version} is empty string. + * @return A {@link Mono} containing the {@link KeyBase updated key}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono updateKey(KeyBase key, KeyOperation... keyOperations) { + return withContext(context -> updateKeyWithResponse(key, keyOperations)) + .flatMap(FluxUtil::toMono); + } + Mono> updateKey(KeyBase key, Context context, KeyOperation... keyOperations) { Objects.requireNonNull(key, "The key input parameter cannot be null."); KeyRequestParameters parameters = new KeyRequestParameters() @@ -491,6 +674,29 @@ Mono> updateKey(KeyBase key, Context context, KeyOperation... keyO .doOnError(error -> logger.warning("Failed to update key - {}", key.name(), error)); } + /** + * Deletes a key of any type from the key vault. If soft-delete is enabled on the key vault then the key is placed in the deleted state + * and requires to be purged for permanent deletion else the key is permanently deleted. The delete operation applies to any key stored + * in Azure Key Vault but it cannot be applied to an individual version of a key. This operation removes the cryptographic material + * associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation + * requires the {@code keys/delete} permission. + * + *

Code Samples

+ *

Deletes the key in the Azure Key Vault. Subscribes to the call asynchronously and prints out the + * deleted key details when a response has been received.

+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.deleteKey#string} + * + * @param name The name of the key to be deleted. + * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a key with {@code name} is empty string. + * @return A {@link Mono} containing the {@link DeletedKey deleted key}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono deleteKey(String name) { + return withContext(context -> deleteKeyWithResponse(name)) + .flatMap(FluxUtil::toMono); + } /** * Deletes a key of any type from the key vault. If soft-delete is enabled on the key vault then the key is placed in the deleted state @@ -502,10 +708,8 @@ Mono> updateKey(KeyBase key, Context context, KeyOperation... keyO *

Code Samples

*

Deletes the key in the Azure Key Vault. Subscribes to the call asynchronously and prints out the * deleted key details when a response has been received.

- *
-     * keyAsyncClient.deleteKey("keyName").subscribe(deletedKeyResponse ->
-     *   System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.value().recoveryId()));
-     * 
+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.deleteKeyWithResponse#string} * * @param name The name of the key to be deleted. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. @@ -513,7 +717,7 @@ Mono> updateKey(KeyBase key, Context context, KeyOperation... keyO * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link DeletedKey deleted key}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> deleteKey(String name) { + public Mono> deleteKeyWithResponse(String name) { return withContext(context -> deleteKey(name, context)); } @@ -533,9 +737,30 @@ Mono> deleteKey(String name, Context context) { * deleted key details when a response has been received.

*
      * //Assuming key is deleted on a soft-delete enabled vault.
-     * keyAsyncClient.getDeletedKey("keyName").subscribe(deletedKeyResponse ->
-     *   System.out.printf("Deleted Key with recovery Id %s \n", deletedKeyResponse.value().recoveryId()));
-     * 
+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.getDeletedKey#string} + * + * @param name The name of the deleted key. + * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a key with {@code name} is empty string. + * @return A {@link Mono} containing the {@link DeletedKey deleted key}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getDeletedKey(String name) { + return withContext(context -> getDeletedKeyWithResponse(name)) + .flatMap(FluxUtil::toMono); + } + + /** + * Gets the public part of a deleted key. The Get Deleted Key operation is applicable for soft-delete enabled vaults. This operation + * requires the {@code keys/get} permission. + * + *

Code Samples

+ *

Gets the deleted key from the key vault enabled for soft-delete. Subscribes to the call asynchronously and prints out the + * deleted key details when a response has been received.

+ *
+     * //Assuming key is deleted on a soft-delete enabled vault.
+     * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.getDeletedKeyWithResponse#string}
      *
      * @param name The name of the deleted key.
      * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault.
@@ -543,7 +768,7 @@ Mono> deleteKey(String name, Context context) {
      * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link DeletedKey deleted key}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Mono> getDeletedKey(String name) {
+    public Mono> getDeletedKeyWithResponse(String name) {
         return withContext(context -> getDeletedKey(name, context));
     }
 
@@ -563,9 +788,7 @@ Mono> getDeletedKey(String name, Context context) {
      * status code from the server response when a response has been received.

*
      * //Assuming key is deleted on a soft-delete enabled vault.
-     * keyAsyncClient.purgeDeletedKey("deletedKeyName").subscribe(purgeResponse ->
-     *   System.out.printf("Purge Status response %rsaPrivateExponent \n", purgeResponse.statusCode()));
-     * 
+ * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.purgeDeletedKey#string} * * @param name The name of the deleted key. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. @@ -594,9 +817,30 @@ Mono purgeDeletedKey(String name, Context context) { * recovered key details when a response has been received.

*
      * //Assuming key is deleted on a soft-delete enabled vault.
-     * keyAsyncClient.recoverDeletedKey("deletedKeyName").subscribe(recoveredKeyResponse ->
-     *   System.out.printf("Recovered Key with name %s \n", recoveredKeyResponse.value().name()));
-     * 
+ * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.recoverDeletedKey#string} + * + * @param name The name of the deleted key to be recovered. + * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a key with {@code name} is empty string. + * @return A {@link Mono} containing the {@link Key recovered key}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono recoverDeletedKey(String name) { + return withContext(context -> recoverDeletedKeyWithResponse(name)) + .flatMap(FluxUtil::toMono); + } + + /** + * Recovers the deleted key in the key vault to its latest version and can only be performed on a soft-delete enabled vault. An attempt + * to recover an non-deleted key will return an error. Consider this the inverse of the delete operation on soft-delete enabled vaults. + * This operation requires the {@code keys/recover} permission. + * + *

Code Samples

+ *

Recovers the deleted key from the key vault enabled for soft-delete. Subscribes to the call asynchronously and prints out the + * recovered key details when a response has been received.

+ *
+     * //Assuming key is deleted on a soft-delete enabled vault.
+     * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.recoverDeletedKeyWithResponse#string}
      *
      * @param name The name of the deleted key to be recovered.
      * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault.
@@ -604,7 +848,7 @@ Mono purgeDeletedKey(String name, Context context) {
      * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link Key recovered key}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Mono> recoverDeletedKey(String name) {
+    public Mono> recoverDeletedKeyWithResponse(String name) {
         return withContext(context -> recoverDeletedKey(name, context));
     }
 
@@ -628,10 +872,35 @@ Mono> recoverDeletedKey(String name, Context context) {
      * 

Code Samples

*

Backs up the key from the key vault. Subscribes to the call asynchronously and prints out the * length of the key's backup byte array returned in the response.

- *
-     * keyAsyncClient.backupKey("keyName").subscribe(keyBackupResponse ->
-     *   System.out.printf("Key's Backup Byte array's length %s \n", keyBackupResponse.value().length));
-     * 
+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.backupKey#string} + * + * @param name The name of the key. + * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a key with {@code name} is empty string. + * @return A {@link Mono} containing the backed up key blob. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono backupKey(String name) { + return withContext(context -> backupKeyWithResponse(name)) + .flatMap(FluxUtil::toMono); + } + + /** + * Requests a backup of the specified key be downloaded to the client. The Key Backup operation exports a key from Azure Key + * Vault in a protected form. Note that this operation does not return key material in a form that can be used outside the Azure Key + * Vault system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The intent + * of this operation is to allow a client to generate a key in one Azure Key Vault instance, backup the key, and then restore it + * into another Azure Key Vault instance. The backup operation may be used to export, in protected form, any key type from Azure + * Key Vault. Individual versions of a key cannot be backed up. Backup / Restore can be performed within geographical boundaries only; + * meaning that a backup from one geographical area cannot be restored to another geographical area. For example, a backup + * from the US geographical area cannot be restored in an EU geographical area. This operation requires the {@code key/backup} permission. + * + *

Code Samples

+ *

Backs up the key from the key vault. Subscribes to the call asynchronously and prints out the + * length of the key's backup byte array returned in the response.

+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.backupKeyWithResponse#string} * * @param name The name of the key. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. @@ -639,7 +908,7 @@ Mono> recoverDeletedKey(String name, Context context) { * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the backed up key blob. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> backupKey(String name) { + public Mono> backupKeyWithResponse(String name) { return withContext(context -> backupKey(name, context)); } @@ -666,16 +935,42 @@ Mono> backupKey(String name, Context context) { * details when a response has been received.

*
      * //Pass the Key Backup Byte array to the restore operation.
-     * keyAsyncClient.restoreKey(keyBackupByteArray).subscribe(keyResponse ->
-     *   System.out.printf("Restored Key with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
-     * 
+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.restoreKey#byte} + * + * @param backup The backup blob associated with the key. + * @throws ResourceModifiedException when {@code backup} blob is malformed. + * @return A {@link Mono} containing the {@link Key restored key}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono restoreKey(byte[] backup) { + return withContext(context -> restoreKeyWithResponse(backup)) + .flatMap(FluxUtil::toMono); + } + + /** + * Restores a backed up key to a vault. Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, + * attributes and access control policies. The restore operation may be used to import a previously backed up key. The individual versions of a + * key cannot be restored. The key is restored in its entirety with the same key name as it had when it was backed up. If the key name is not + * available in the target Key Vault, the restore operation will be rejected. While the key name is retained during restore, the final key identifier + * will change if the key is restored to a different vault. Restore will restore all versions and preserve version identifiers. The restore operation is subject + * to security constraints: The target Key Vault must be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have restore permission in + * the target Key Vault. This operation requires the {@code keys/restore} permission. + * + *

Code Samples

+ *

Restores the key in the key vault from its backup. Subscribes to the call asynchronously and prints out the restored key + * details when a response has been received.

+ *
+     * //Pass the Key Backup Byte array to the restore operation.
+     *
+     * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.restoreKeyWithResponse#byte}
      *
      * @param backup The backup blob associated with the key.
      * @throws ResourceModifiedException when {@code backup} blob is malformed.
      * @return A {@link Mono} containing a {@link Response} whose {@link Response#value() value} contains the {@link Key restored key}.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Mono> restoreKey(byte[] backup) {
+    public Mono> restoreKeyWithResponse(byte[] backup) {
         return withContext(context -> restoreKey(backup, context));
     }
 
@@ -694,11 +989,8 @@ Mono> restoreKey(byte[] backup, Context context) {
      *
      * 

It is possible to get full keys with key material from this information. Convert the {@link Flux} containing {@link KeyBase base key} to * {@link Flux} containing {@link Key key} using {@link KeyAsyncClient#getKey(KeyBase baseKey)} within {@link Flux#flatMap(Function)}.

- *
-     * Flux<Key> keys = keyAsyncClient.listKeys()
-     *   .flatMap(keyAsyncClient::getKey)
-     *   .map(Response::value);
-     * 
+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.listKeys} * * @return A {@link PagedFlux} containing {@link KeyBase key} of all the keys in the vault. */ @@ -747,10 +1039,8 @@ private Mono> listKeysFirstPage(Context context) { *

Code Samples

*

Lists the deleted keys in the key vault. Subscribes to the call asynchronously and prints out the * recovery id of each deleted key when a response has been received.

- *
-     * keyAsyncClient.listDeletedKeys().subscribe(deletedKey ->
-     *   System.out.printf("Deleted key's recovery Id %s \n", deletedKey.recoveryId()));
-     * 
+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.listDeletedKeys} * * @return A {@link PagedFlux} containing all of the {@link DeletedKey deleted keys} in the vault. */ @@ -799,11 +1089,8 @@ private Mono> listDeletedKeysFirstPage(Context context *

It is possible to get the keys with key material of all the versions from this information. Convert the {@link Flux} * containing {@link KeyBase base key} to {@link Flux} containing {@link Key key} using * {@link KeyAsyncClient#getKey(KeyBase baseKey)} within {@link Flux#flatMap(Function)}.

- *
-     * Flux<Key> keys = keyAsyncClient.listKeyVersions("keyName")
-     *   .flatMap(keyAsyncClient::getKey)
-     *   .map(Response::value);
-     * 
+ * + * {@codesnippet com.azure.security.keyvault.keys.async.keyclient.listKeyVersions} * * @param name The name of the key. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java index 44e8bac28851e..517883dd328fb 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClient.java @@ -9,6 +9,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; import com.azure.core.implementation.annotation.ServiceClient; +import com.azure.core.util.Context; import com.azure.security.keyvault.keys.models.Key; import com.azure.security.keyvault.keys.models.KeyCreateOptions; import com.azure.security.keyvault.keys.models.DeletedKey; @@ -22,6 +23,7 @@ import com.azure.security.keyvault.keys.models.webkey.KeyType; import java.util.List; +import java.util.Objects; /** * The KeyClient provides synchronous methods to manage {@link Key keys} in the Azure Key Vault. The client @@ -61,10 +63,10 @@ public final class KeyClient { * @param keyType The type of key to create. For valid values, see {@link KeyType KeyType}. * @throws ResourceModifiedException if {@code name} or {@code keyType} is null. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link Key created key}. + * @return The {@link Key created key}. */ - public Response createKey(String name, KeyType keyType) { - return client.createKey(name, keyType).block(); + public Key createKey(String name, KeyType keyType) { + return client.createKey(name, keyType, Context.NONE).block().value(); } /** @@ -79,23 +81,41 @@ public Response createKey(String name, KeyType keyType) { * *

Code Samples

*

Creates a new RSA key which activates in one day and expires in one year. Prints out the details of the created key.

- *
-     * KeyCreateOptions KeyCreateOptions = new KeyCreateOptions("keyName", KeyType.RSA)
-     *    .notBefore(OffsetDateTime.now().plusDays(1))
-     *    .expires(OffsetDateTime.now().plusYears(1));
+     * {@codesnippet com.azure.keyvault.keys.keyclient.createKey#keyOptions}
      *
-     * Key key = keyClient.createKey(keyCreateOptions).value();
-     * System.out.printf("Key is created with name %s and id %s \n", key.name(), key.id());
-     * 
+ * @param keyCreateOptions The key options object containing information about the key being created. + * @throws NullPointerException if {@code keyCreateOptions} is {@code null}. + * @throws ResourceModifiedException if {@code keyCreateOptions} is malformed. + * @throws HttpRequestException if {@code name} is empty string. + * @return The {@link Key created key}. + */ + public Key createKey(KeyCreateOptions keyCreateOptions) { + return this.createKeyWithResponse(keyCreateOptions, Context.NONE).value(); + } + + /** + * Creates a new key and stores it in the key vault. The create key operation can be used to create any key type in + * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * + *

The {@link KeyCreateOptions} is required. The {@link KeyCreateOptions#expires() expires} and {@link KeyCreateOptions#notBefore() notBefore} values + * are optional. The {@link KeyCreateOptions#enabled() enabled} field is set to true by Azure Key Vault, if not specified.

+ * + *

The {@link KeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: {@link KeyType#EC EC}, + * {@link KeyType#EC_HSM EC-HSM}, {@link KeyType#RSA RSA}, {@link KeyType#RSA_HSM RSA-HSM} and {@link KeyType#OCT OCT}.

+ * + *

Code Samples

+ *

Creates a new RSA key which activates in one day and expires in one year. Prints out the details of the created key.

+ * {@codesnippet com.azure.keyvault.keys.keyclient.createKeyWithResponse#keyCreateOptions-Context} * * @param keyCreateOptions The key options object containing information about the key being created. + * @param context Additional context that is passed through the Http pipeline during the service call. * @throws NullPointerException if {@code keyCreateOptions} is {@code null}. * @throws ResourceModifiedException if {@code keyCreateOptions} is malformed. * @throws HttpRequestException if {@code name} is empty string. * @return A {@link Response} whose {@link Response#value() value} contains the {@link Key created key}. */ - public Response createKey(KeyCreateOptions keyCreateOptions) { - return client.createKey(keyCreateOptions).block(); + public Response createKeyWithResponse(KeyCreateOptions keyCreateOptions, Context context) { + return client.createKey(keyCreateOptions, context).block(); } /** @@ -111,24 +131,42 @@ public Response createKey(KeyCreateOptions keyCreateOptions) { * *

Code Samples

*

Creates a new RSA key with size 2048 which activates in one day and expires in one year. Prints out the details of the created key.

- *
-     * RsaKeyCreateOptions rsaKeyCreateOptions = new RsaKeyCreateOptions("keyName", KeyType.RSA)
-     *    .keySize(2048)
-     *    .notBefore(OffsetDateTime.now().plusDays(1))
-     *    .expires(OffsetDateTime.now().plusYears(1));
+     * {@codesnippet com.azure.keyvault.keys.keyclient.createRsaKey#keyOptions}
      *
-     * Key rsaKey = keyClient.createRsaKey(rsaKeyCreateOptions).value();
-     * System.out.printf("Key is created with name %s and id %s \n", rsaKey.name(), rsaKey.id());
-     * 
+ * @param rsaKeyCreateOptions The key options object containing information about the rsa key being created. + * @throws NullPointerException if {@code rsaKeyCreateOptions} is {@code null}. + * @throws ResourceModifiedException if {@code rsaKeyCreateOptions} is malformed. + * @throws HttpRequestException if {@code name} is empty string. + * @return The {@link Key created key}. + */ + public Key createRsaKey(RsaKeyCreateOptions rsaKeyCreateOptions) { + return this.createKeyWithResponse(rsaKeyCreateOptions, Context.NONE).value(); + } + + /** + * Creates a new Rsa key and stores it in the key vault. The create Rsa key operation can be used to create any Rsa key type in + * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * + *

The {@link RsaKeyCreateOptions} is required. The {@link RsaKeyCreateOptions#keySize() keySize} can be optionally specified. The {@link RsaKeyCreateOptions#expires() expires} + * and {@link RsaKeyCreateOptions#notBefore() notBefore} values are optional. The {@link RsaKeyCreateOptions#enabled() enabled} field + * is set to true by Azure Key Vault, if not specified.

+ * + *

The {@link RsaKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: {@link KeyType#RSA RSA} and + * {@link KeyType#RSA_HSM RSA-HSM}.

+ * + *

Code Samples

+ *

Creates a new RSA key with size 2048 which activates in one day and expires in one year. Prints out the details of the created key.

+ * {@codesnippet com.azure.keyvault.keys.keyclient.createRsaKeyWithResponse#keyOptions} * * @param rsaKeyCreateOptions The key options object containing information about the rsa key being created. + * @param context Additional context that is passed through the Http pipeline during the service call. * @throws NullPointerException if {@code rsaKeyCreateOptions} is {@code null}. * @throws ResourceModifiedException if {@code rsaKeyCreateOptions} is malformed. * @throws HttpRequestException if {@code name} is empty string. * @return A {@link Response} whose {@link Response#value() value} contains the {@link Key created key}. */ - public Response createRsaKey(RsaKeyCreateOptions rsaKeyCreateOptions) { - return client.createRsaKey(rsaKeyCreateOptions).block(); + public Response createRsaKeyWithResponse(RsaKeyCreateOptions rsaKeyCreateOptions, Context context) { + return client.createRsaKey(rsaKeyCreateOptions, context).block(); } /** @@ -145,24 +183,43 @@ public Response createRsaKey(RsaKeyCreateOptions rsaKeyCreateOptions) { *

Code Samples

*

Creates a new EC key with P-384 web key curve. The key activates in one day and expires in one year. Prints out * the details of the created key.

- *
-     * EcKeyCreateOptions ecKeyCreateOptions = new EcKeyCreateOptions("keyName", KeyType.EC)
-     *    .curve(KeyCurveName.P_384)
-     *    .notBefore(OffsetDateTime.now().plusDays(1))
-     *    .expires(OffsetDateTime.now().plusYears(1));
+     * {@codesnippet com.azure.keyvault.keys.keyclient.createEcKey#keyOptions}
      *
-     * Key ecKey = keyClient.createEcKey(ecKeyCreateOptions).value();
-     * System.out.printf("Key is created with name %s and id %s \n", ecKey.name(), ecKey.id());
-     * 
+ * @param ecKeyCreateOptions The key options object containing information about the ec key being created. + * @throws NullPointerException if {@code ecKeyCreateOptions} is {@code null}. + * @throws ResourceModifiedException if {@code ecKeyCreateOptions} is malformed. + * @throws HttpRequestException if {@code name} is empty string. + * @return The {@link Key created key}. + */ + public Key createEcKey(EcKeyCreateOptions ecKeyCreateOptions) { + return this.createEcKeyWithResponse(ecKeyCreateOptions, Context.NONE).value(); + } + + /** + * Creates a new Ec key and stores it in the key vault. The create Ec key operation can be used to create any Ec key type in + * key vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the {@code keys/create} permission. + * + *

The {@link EcKeyCreateOptions} parameter is required. The {@link EcKeyCreateOptions#curve() key curve} can be optionally specified. If not specified, + * default value of {@link KeyCurveName#P_256 P-256} is used by Azure Key Vault. The {@link EcKeyCreateOptions#expires() expires} and {@link EcKeyCreateOptions#notBefore() notBefore} values + * are optional. The {@link EcKeyCreateOptions#enabled() enabled} field is set to true by Azure Key Vault, if not specified.

+ * + *

The {@link EcKeyCreateOptions#keyType() keyType} indicates the type of key to create. Possible values include: {@link KeyType#EC EC} and + * {@link KeyType#EC_HSM EC-HSM}.

+ * + *

Code Samples

+ *

Creates a new EC key with P-384 web key curve. The key activates in one day and expires in one year. Prints out + * the details of the created key.

+ * {@codesnippet com.azure.keyvault.keys.keyclient.createEcKeyWithResponse#keyOptions} * * @param ecKeyCreateOptions The key options object containing information about the ec key being created. + * @param context Additional context that is passed through the Http pipeline during the service call. * @throws NullPointerException if {@code ecKeyCreateOptions} is {@code null}. * @throws ResourceModifiedException if {@code ecKeyCreateOptions} is malformed. * @throws HttpRequestException if {@code name} is empty string. * @return A {@link Response} whose {@link Response#value() value} contains the {@link Key created key}. */ - public Response createEcKey(EcKeyCreateOptions ecKeyCreateOptions) { - return client.createEcKey(ecKeyCreateOptions).block(); + public Response createEcKeyWithResponse(EcKeyCreateOptions ecKeyCreateOptions, Context context) { + return client.createEcKey(ecKeyCreateOptions, context).block(); } /** @@ -172,17 +229,46 @@ public Response createEcKey(EcKeyCreateOptions ecKeyCreateOptions) { *

Code Samples

*

Imports a new key into key vault. Prints out the details of the imported key.

*
-     * Key importedKey = keyClient.importKey("keyName", jsonWebKeyToImport).value();
+     * Key importedKey = keyClient.importKey("keyName", jsonWebKeyToImport);
      * System.out.printf("Key is imported with name %s and id %s \n", importedKey.name(), importedKey.id());
      * 
* * @param name The name for the imported key. * @param keyMaterial The Json web key being imported. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the {@link Key imported key}. + * @return The {@link Key imported key}. + */ + public Key importKey(String name, JsonWebKey keyMaterial) { + return client.importKey(name, keyMaterial, Context.NONE).block().value(); + } + + /** + * Imports an externally created key and stores it in key vault. The import key operation may be used to import any key type + * into the Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. This operation requires the {@code keys/import} permission. + * + *

The {@code keyImportOptions} is required and its fields {@link KeyImportOptions#name() name} and {@link KeyImportOptions#keyMaterial() key material} cannot + * be null. The {@link KeyImportOptions#expires() expires} and {@link KeyImportOptions#notBefore() notBefore} values in {@code keyImportOptions} are optional. If not + * specified, no values are set for the fields. The {@link KeyImportOptions#enabled() enabled} field is set to true and the {@link KeyImportOptions#hsm() hsm} field is + * set to false by Azure Key Vault, if they are not specified.

+ * + *

Code Samples

+ *

Imports a new key into key vault. Prints out the details of the imported key.

+ *
+     * KeyImportOptions keyImportOptions = new KeyImportOptions("keyName", jsonWebKeyToImport)
+     *   .hsm(true)
+     *   .expires(OffsetDateTime.now().plusDays(60));
+     *
+     * Key importedKey = keyClient.importKey(keyImportOptions);
+     * System.out.printf("Key is imported with name %s and id %s \n", importedKey.name(), importedKey.id());
+     * 
+ * + * @param keyImportOptions The key import configuration object containing information about the json web key being imported. + * @throws NullPointerException if {@code keyImportOptions} is {@code null}. + * @throws HttpRequestException if {@code name} is empty string. + * @return The {@link Key imported key}. */ - public Response importKey(String name, JsonWebKey keyMaterial) { - return client.importKey(name, keyMaterial).block(); + public Key importKey(KeyImportOptions keyImportOptions) { + return this.importKeyWithResponse(keyImportOptions, Context.NONE).value(); } /** @@ -201,17 +287,18 @@ public Response importKey(String name, JsonWebKey keyMaterial) { * .hsm(true) * .expires(OffsetDateTime.now().plusDays(60)); * - * Key importedKey = keyClient.importKey(keyImportOptions).value(); + * Key importedKey = keyClient.importKey(keyImportOptions, new Context(key1, value1)).value(); * System.out.printf("Key is imported with name %s and id %s \n", importedKey.name(), importedKey.id()); *
* * @param keyImportOptions The key import configuration object containing information about the json web key being imported. + * @param context Additional context that is passed through the Http pipeline during the service call. * @throws NullPointerException if {@code keyImportOptions} is {@code null}. * @throws HttpRequestException if {@code name} is empty string. * @return A {@link Response} whose {@link Response#value() value} contains the {@link Key imported key}. */ - public Response importKey(KeyImportOptions keyImportOptions) { - return client.importKey(keyImportOptions).block(); + public Response importKeyWithResponse(KeyImportOptions keyImportOptions, Context context) { + return client.importKey(keyImportOptions, context).block(); } /** @@ -219,20 +306,34 @@ public Response importKey(KeyImportOptions keyImportOptions) { * *

Code Samples

*

Gets a specific version of the key in the key vault. Prints out the details of the returned key.

- *
-     * String keyVersion = "6A385B124DEF4096AF1361A85B16C204";
-     * Key keyWithVersion = keyClient.getKey("keyName", keyVersion).value();
-     * System.out.printf("Key is returned with name %s and id %s \n", keyWithVersion.name(), keyWithVersion.id());
-     * 
+ * {@codesnippet com.azure.keyvault.keys.keyclient.getKey#string-string} + * + * @param name The name of the key, cannot be null + * @param version The version of the key to retrieve. If this is an empty String or null, this call is equivalent to calling {@link KeyClient#getKey(String)}, with the latest version being retrieved. + * @throws ResourceNotFoundException when a key with {@code name} and {@code version} doesn't exist in the key vault. + * @throws HttpRequestException if {@code name} or {@code version} is empty string. + * @return The requested {@link Key key}. + */ + public Key getKey(String name, String version) { + return this.getKeyWithResponse(name, version, Context.NONE).value(); + } + + /** + * Gets the public part of the specified key and key version. The get key operation is applicable to all key types and it requires the {@code keys/get} permission. + * + *

Code Samples

+ *

Gets a specific version of the key in the key vault. Prints out the details of the returned key.

+ * {@codesnippet com.azure.keyvault.keys.keyclient.getKeyWithResponse#string-string-Context} * * @param name The name of the key, cannot be null + * @param context Additional context that is passed through the Http pipeline during the service call. * @param version The version of the key to retrieve. If this is an empty String or null, this call is equivalent to calling {@link KeyClient#getKey(String)}, with the latest version being retrieved. * @throws ResourceNotFoundException when a key with {@code name} and {@code version} doesn't exist in the key vault. * @throws HttpRequestException if {@code name} or {@code version} is empty string. * @return A {@link Response} whose {@link Response#value() value} contains the requested {@link Key key}. */ - public Response getKey(String name, String version) { - return client.getKey(name, version).block(); + public Response getKeyWithResponse(String name, String version, Context context) { + return client.getKey(name, version, context).block(); } /** @@ -241,21 +342,17 @@ public Response getKey(String name, String version) { * *

Code Samples

*

Gets the latest version of the key in the key vault. Prints out the details of the returned key.

- *
-     * Key key = keyClient.getKey("keyName").value();
-     * System.out.printf("Key is returned with name %s and id %s \n", key.name(), key.value().id());
-     * 
+ * {@codesnippet com.azure.keyvault.keys.keyclient.getKey#string} * * @param name The name of the key. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException if {@code name} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the requested {@link Key key}. + * @return The requested {@link Key key}. */ - public Response getKey(String name) { - return getKey(name, ""); + public Key getKey(String name) { + return this.getKeyWithResponse(name, "", Context.NONE).value(); } - /** * Get public part of the key which represents {@link KeyBase keyBase} from the key vault. The get key operation is applicable * to all key types and it requires the {@code keys/get} permission. @@ -263,18 +360,19 @@ public Response getKey(String name) { *

The list operations {@link KeyClient#listKeys()} and {@link KeyClient#listKeyVersions(String)} return * the {@link List} containing {@link KeyBase base key} as output excluding the key material of the key. * This operation can then be used to get the full key with its key material from {@code keyBase}.

- *
-     * keyClient.listKeys().stream().map(keyClient::getKey).forEach(keyResponse ->
-     *   System.out.printf("Key is returned with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
-     * 
+ * {@codesnippet com.azure.keyvault.keys.keyclient.getKey#KeyBase} * * @param keyBase The {@link KeyBase base key} holding attributes of the key being requested. * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. * @throws HttpRequestException if {@link KeyBase#name()} name} or {@link KeyBase#version() version} is empty string. - * @return A {@link Response} whose {@link Response#value() value} contains the requested {@link Key key}. + * @return The requested {@link Key key}. */ - public Response getKey(KeyBase keyBase) { - return client.getKey(keyBase).block(); + public Key getKey(KeyBase keyBase) { + Objects.requireNonNull(keyBase, "The Key Base parameter cannot be null."); + if (keyBase.version() == null) { + return getKey(keyBase.name()); + } + return getKeyWithResponse(keyBase.name(), keyBase.version(), Context.NONE).value(); } /** @@ -284,21 +382,36 @@ public Response getKey(KeyBase keyBase) { * *

Code Samples

*

Gets the latest version of the key, changes its expiry time and the updates the key in the key vault.

- *
-     * Key key = keyClient.getKey("keyName").value();
-     * key.expires(OffsetDateTime.now().plusDays(60));
-     * KeyBase updatedKeyBase = keyClient.updateKey(key).value();
-     * Key updatedKey = keyClient.getKey(updatedKeyBase.name()).value();
-     * 
+ * {@codesnippet com.azure.keyvault.keys.keyclient.updateKey#KeyBase} + * + * @param key The {@link KeyBase base key} object with updated properties. + * @throws NullPointerException if {@code key} is {@code null}. + * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. + * @throws HttpRequestException if {@link KeyBase#name() name} or {@link KeyBase#version() version} is empty string. + * @return The {@link KeyBase updated key}. + */ + public Key updateKey(KeyBase key) { + return this.updateKeyWithResponse(key, Context.NONE).value(); + } + + /** + * Updates the attributes and key operations associated with the specified key, but not the cryptographic key material of the specified key in the key vault. The update + * operation changes specified attributes of an existing stored key and attributes that are not specified in the request are left unchanged. + * The cryptographic key material of a key itself cannot be changed. This operation requires the {@code keys/set} permission. + * + *

Code Samples

+ *

Gets the latest version of the key, changes its expiry time and key operations and the updates the key in the key vault.

+ * {@codesnippet com.azure.keyvault.keys.keyclient.updateKey#KeyBase-keyOperations} * * @param key The {@link KeyBase base key} object with updated properties. + * @param keyOperations The updated key operations to associate with the key. * @throws NullPointerException if {@code key} is {@code null}. * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. * @throws HttpRequestException if {@link KeyBase#name() name} or {@link KeyBase#version() version} is empty string. * @return A {@link Response} whose {@link Response#value() value} contains the {@link KeyBase updated key}. */ - public Response updateKey(KeyBase key) { - return client.updateKey(key).block(); + public Key updateKey(KeyBase key, KeyOperation... keyOperations) { + return this.updateKeyWithResponse(key, Context.NONE, keyOperations).value(); } /** @@ -308,22 +421,18 @@ public Response updateKey(KeyBase key) { * *

Code Samples

*

Gets the latest version of the key, changes its expiry time and key operations and the updates the key in the key vault.

- *
-     * Key key = keyClient.getKey("keyName").value();
-     * key.expires(OffsetDateTime.now().plusDays(60));
-     * KeyBase updatedKeyBase = keyClient.updateKey(key, KeyOperation.ENCRYPT, KeyOperation.DECRYPT).value();
-     * Key updatedKey = keyClient.getKey(updatedKeyBase.name()).value();
-     * 
+ * {@codesnippet com.azure.keyvault.keys.keyclient.updateKeyWithResponse#KeyBase-keyOperations-Context} * * @param key The {@link KeyBase base key} object with updated properties. + * @param context Additional context that is passed through the Http pipeline during the service call. * @param keyOperations The updated key operations to associate with the key. * @throws NullPointerException if {@code key} is {@code null}. * @throws ResourceNotFoundException when a key with {@link KeyBase#name() name} and {@link KeyBase#version() version} doesn't exist in the key vault. * @throws HttpRequestException if {@link KeyBase#name() name} or {@link KeyBase#version() version} is empty string. * @return A {@link Response} whose {@link Response#value() value} contains the {@link KeyBase updated key}. */ - public Response updateKey(KeyBase key, KeyOperation... keyOperations) { - return client.updateKey(key, keyOperations).block(); + public Response updateKeyWithResponse(KeyBase key, Context context, KeyOperation... keyOperations) { + return client.updateKey(key, context, keyOperations).block(); } /** @@ -335,18 +444,36 @@ public Response updateKey(KeyBase key, KeyOperation... keyOperations) { * *

Code Samples

*

Deletes the key from the keyvault. Prints out the recovery id of the deleted key returned in the response.

- *
-     * DeletedKey deletedKey = keyClient.deleteKey("keyName").value();
-     * System.out.printf("Deleted Key's Recovery Id %s", deletedKey.recoveryId()));
-     * 
+ * {@codesnippet com.azure.keyvault.keys.keyclient.deleteKey#string} + * + * @param name The name of the key to be deleted. + * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a key with {@code name} is empty string. + * @return The {@link DeletedKey deleted key}. + */ + public DeletedKey deleteKey(String name) { + return this.deleteKeyWithResponse(name, Context.NONE).value(); + } + + /** + * Deletes a key of any type from the key vault. If soft-delete is enabled on the key vault then the key is placed in the deleted state + * and requires to be purged for permanent deletion else the key is permanently deleted. The delete operation applies to any key stored + * in Azure Key Vault but it cannot be applied to an individual version of a key. This operation removes the cryptographic material + * associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation + * requires the {@code keys/delete} permission. + * + *

Code Samples

+ *

Deletes the key from the keyvault. Prints out the recovery id of the deleted key returned in the response.

+ * {@codesnippet com.azure.keyvault.keys.keyclient.deleteKeyWithResponse#string-Context} * * @param name The name of the key to be deleted. + * @param context Additional context that is passed through the Http pipeline during the service call. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. * @return A {@link Response} whose {@link Response#value() value} contains the {@link DeletedKey deleted key}. */ - public Response deleteKey(String name) { - return client.deleteKey(name).block(); + public Response deleteKeyWithResponse(String name, Context context) { + return client.deleteKey(name, context).block(); } /** @@ -358,17 +485,37 @@ public Response deleteKey(String name) { * returned in the response.

*
      * //Assuming key is deleted on a soft-delete enabled key vault.
-     * DeletedKey deletedKey = keyClient.getDeletedKey("keyName").value();
-     * System.out.printf("Deleted Key with recovery Id %s \n", deletedKey.recoveryId());
+     * {@codesnippet com.azure.keyvault.keys.keyclient.getDeletedKey#string}
      * 
* * @param name The name of the deleted key. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. + * @return The {@link DeletedKey deleted key}. + */ + public DeletedKey getDeletedKey(String name) { + return this.getDeletedKeyWithResponse(name, Context.NONE).value(); + } + + /** + * Gets the public part of a deleted key. The Get Deleted Key operation is applicable for soft-delete enabled vaults. This operation + * requires the {@code keys/get} permission. + * + *

Code Samples

+ *

Gets the deleted key from the key vault enabled for soft-delete. Prints out the details of the deleted key + * returned in the response.

+ *
+     * //Assuming key is deleted on a soft-delete enabled key vault.
+     * {@codesnippet com.azure.keyvault.keys.keyclient.getDeletedKeyWithResponse#string-Context}
+     *
+     * @param name The name of the deleted key.
+     * @param context Additional context that is passed through the Http pipeline during the service call.
+     * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault.
+     * @throws HttpRequestException when a key with {@code name} is empty string.
      * @return A {@link Response} whose {@link Response#value() value} contains the {@link DeletedKey deleted key}.
      */
-    public Response getDeletedKey(String name) {
-        return client.getDeletedKey(name).block();
+    public Response getDeletedKeyWithResponse(String name, Context context) {
+        return client.getDeletedKey(name, context).block();
     }
 
     /**
@@ -377,11 +524,8 @@ public Response getDeletedKey(String name) {
      *
      * 

Code Samples

*

Purges the deleted key from the key vault enabled for soft-delete. Prints out the status code from the server response.

- *
      * //Assuming key is deleted on a soft-delete enabled key vault.
-     * VoidResponse purgeResponse = keyClient.purgeDeletedKey("deletedKeyName");
-     * System.out.printf("Purge Status Code: %rsaPrivateExponent", purgeResponse.statusCode());
-     * 
+ * {@codesnippet com.azure.keyvault.keys.keyclient.purgeDeletedKey#string} * * @param name The name of the deleted key. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. @@ -389,7 +533,26 @@ public Response getDeletedKey(String name) { * @return A {@link VoidResponse}. */ public VoidResponse purgeDeletedKey(String name) { - return client.purgeDeletedKey(name).block(); + return client.purgeDeletedKey(name, Context.NONE).block(); + } + + /** + * Permanently deletes the specified key without the possibility of recovery. The Purge Deleted Key operation is applicable for + * soft-delete enabled vaults. This operation requires the {@code keys/purge} permission. + * + *

Code Samples

+ *

Purges the deleted key from the key vault enabled for soft-delete. Prints out the status code from the server response.

+ * //Assuming key is deleted on a soft-delete enabled key vault. + * {@codesnippet com.azure.keyvault.keys.keyclient.purgeDeletedKey#string-Context} + * + * @param name The name of the deleted key. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a key with {@code name} is empty string. + * @return A {@link VoidResponse}. + */ + public VoidResponse purgeDeletedKey(String name, Context context) { + return client.purgeDeletedKey(name, context).block(); } /** @@ -399,19 +562,36 @@ public VoidResponse purgeDeletedKey(String name) { * *

Code Samples

*

Recovers the deleted key from the key vault enabled for soft-delete.

- *
      * //Assuming key is deleted on a soft-delete enabled key vault.
-     * Key recoveredKey =  keyClient.recoverDeletedKey("deletedKeyName").value();
-     * System.out.printf("Recovered key with name %s", recoveredKey.name());
-     * 
+ * {@codesnippet com.azure.keyvault.keys.keyclient.recoverDeletedKey#string} + * + * @param name The name of the deleted key to be recovered. + * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a key with {@code name} is empty string. + * @return The {@link Key recovered key}. + */ + public Key recoverDeletedKey(String name) { + return this.recoverDeletedKeyWithResponse(name, Context.NONE).value(); + } + + /** + * Recovers the deleted key in the key vault to its latest version and can only be performed on a soft-delete enabled vault. An attempt + * to recover an non-deleted key will return an error. Consider this the inverse of the delete operation on soft-delete enabled vaults. + * This operation requires the {@code keys/recover} permission. + * + *

Code Samples

+ *

Recovers the deleted key from the key vault enabled for soft-delete.

+ * //Assuming key is deleted on a soft-delete enabled key vault. + * {@codesnippet com.azure.keyvault.keys.keyclient.recoverDeletedKeyWithResponse#string-Context} * * @param name The name of the deleted key to be recovered. + * @param context Additional context that is passed through the Http pipeline during the service call. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. * @return A {@link Response} whose {@link Response#value() value} contains the {@link Key recovered key}. */ - public Response recoverDeletedKey(String name) { - return client.recoverDeletedKey(name).block(); + public Response recoverDeletedKeyWithResponse(String name, Context context) { + return client.recoverDeletedKey(name, context).block(); } /** @@ -426,18 +606,39 @@ public Response recoverDeletedKey(String name) { * *

Code Samples

*

Backs up the key from the key vault and prints out the length of the key's backup byte array returned in the response

- *
-     * byte[] keyBackup = keyClient.backupKey("keyName").value();
-     * System.out.printf("Key's Backup Byte array's length %s", keyBackup.length);
-     * 
+ * {@codesnippet com.azure.keyvault.keys.keyclient.backupKey#string} + * + * @param name The name of the key. + * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a key with {@code name} is empty string. + * @return The backed up key blob. + */ + public byte[] backupKey(String name) { + return this.backupKeyWithResponse(name, Context.NONE).value(); + } + + /** + * Requests a backup of the specified key be downloaded to the client. The Key Backup operation exports a key from Azure Key + * Vault in a protected form. Note that this operation does not return key material in a form that can be used outside the Azure Key + * Vault system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key Vault itself. The intent + * of this operation is to allow a client to generate a key in one Azure Key Vault instance, backup the key, and then restore it + * into another Azure Key Vault instance. The backup operation may be used to export, in protected form, any key type from Azure + * Key Vault. Individual versions of a key cannot be backed up. Backup / Restore can be performed within geographical boundaries only; + * meaning that a backup from one geographical area cannot be restored to another geographical area. For example, a backup + * from the US geographical area cannot be restored in an EU geographical area. This operation requires the {@code key/backup} permission. + * + *

Code Samples

+ *

Backs up the key from the key vault and prints out the length of the key's backup byte array returned in the response

+ * {@codesnippet com.azure.keyvault.keys.keyclient.backupKeyWithResponse#string-Context} * * @param name The name of the key. + * @param context Additional context that is passed through the Http pipeline during the service call. * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. * @throws HttpRequestException when a key with {@code name} is empty string. * @return A {@link Response} whose {@link Response#value() value} contains the backed up key blob. */ - public Response backupKey(String name) { - return client.backupKey(name).block(); + public Response backupKeyWithResponse(String name, Context context) { + return client.backupKey(name, context).block(); } /** @@ -451,18 +652,38 @@ public Response backupKey(String name) { * *

Code Samples

*

Restores the key in the key vault from its backup. Prints out the details of the restored key returned in the response.

- *
      * //Pass the Key Backup Byte array to the restore operation.
-     * KeyClient.restoreKey(keyBackupByteArray).subscribe(keyResponse ->
-     *   System.out.printf("Restored Key with name %s and id %s \n", keyResponse.value().name(), keyResponse.value().id()));
-     * 
+ * {@codesnippet com.azure.keyvault.keys.keyclient.restoreKey#byte} + * + * @param backup The backup blob associated with the key. + * @throws ResourceModifiedException when {@code backup} blob is malformed. + * @return The {@link Key restored key}. + */ + public Key restoreKey(byte[] backup) { + return this.restoreKeyWithResponse(backup, Context.NONE).value(); + } + + /** + * Restores a backed up key to a vault. Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, + * attributes and access control policies. The restore operation may be used to import a previously backed up key. Individual versions of a + * key cannot be restored. The key is restored in its entirety with the same key name as it had when it was backed up. If the key name is not + * available in the target Key Vault, the restore operation will be rejected. While the key name is retained during restore, the final key identifier + * will change if the key is restored to a different vault. Restore will restore all versions and preserve version identifiers. The restore operation is subject + * to security constraints: The target Key Vault must be owned by the same Microsoft Azure Subscription as the source Key Vault The user must have restore permission in + * the target Key Vault. This operation requires the {@code keys/restore} permission. + * + *

Code Samples

+ *

Restores the key in the key vault from its backup. Prints out the details of the restored key returned in the response.

+ * //Pass the Key Backup Byte array to the restore operation. + * {@codesnippet com.azure.keyvault.keys.keyclient.restoreKeyWithResponse#byte-Context} * * @param backup The backup blob associated with the key. + * @param context Additional context that is passed through the Http pipeline during the service call. * @throws ResourceModifiedException when {@code backup} blob is malformed. * @return A {@link Response} whose {@link Response#value() value} contains the {@link Key restored key}. */ - public Response restoreKey(byte[] backup) { - return client.restoreKey(backup).block(); + public Response restoreKeyWithResponse(byte[] backup, Context context) { + return client.restoreKey(backup, context).block(); } /** @@ -472,17 +693,28 @@ public Response restoreKey(byte[] backup) { * *

It is possible to get full keys with key material from this information. Loop over the {@link KeyBase key} and * call {@link KeyClient#getKey(KeyBase baseKey)} . This will return the {@link Key key} with key material included of its latest version.

- *
-     * for (KeyBase key : keyClient.listKeys()) {
-     *   Key keyWithMaterial = keyClient.getKey(key).value();
-     *   System.out.printf("Received key with name %s and type %s", keyWithMaterial.name(), keyWithMaterial.keyMaterial().kty());
-     * }
-     * 
+ * {@codesnippet com.azure.keyvault.keys.keyclient.listKeys} * * @return A {@link List} containing {@link KeyBase key} of all the keys in the vault. */ public Iterable listKeys() { - return client.listKeys().toIterable(); + return client.listKeys(Context.NONE).toIterable(); + } + + /** + * List keys in the key vault. Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the public + * part of a stored key. The List operation is applicable to all key types and the individual key response in the list is represented by {@link KeyBase} as only the base key identifier, + * attributes and tags are provided in the response. The key material and individual key versions are not listed in the response. This operation requires the {@code keys/list} permission. + * + *

It is possible to get full keys with key material from this information. Loop over the {@link KeyBase key} and + * call {@link KeyClient#getKey(KeyBase baseKey)} . This will return the {@link Key key} with key material included of its latest version.

+ * {@codesnippet com.azure.keyvault.keys.keyclient.listKeys#Context} + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link List} containing {@link KeyBase key} of all the keys in the vault. + */ + public Iterable listKeys(Context context) { + return client.listKeys(context).toIterable(); } /** @@ -492,11 +724,7 @@ public Iterable listKeys() { * *

Code Samples

*

Lists the deleted keys in the key vault and for each deleted key prints out its recovery id.

- *
-     * for (DeletedKey deletedKey : keyClient.listDeletedKeys()) {
-     *   System.out.printf("Deleted key's recovery Id %s", deletedKey.recoveryId());
-     * }
-     * 
+ * {@codesnippet com.azure.keyvault.keys.keyclient.listDeletedKeys} * * @return A {@link List} containing all of the {@link DeletedKey deleted keys} in the vault. */ @@ -504,6 +732,22 @@ public Iterable listDeletedKeys() { return client.listDeletedKeys().toIterable(); } + /** + * Lists {@link DeletedKey deleted keys} of the key vault. The deleted keys are retrieved as JSON Web Key structures + * that contain the public part of a deleted key. The Get Deleted Keys operation is applicable for vaults enabled + * for soft-delete. This operation requires the {@code keys/list} permission. + * + *

Code Samples

+ *

Lists the deleted keys in the key vault and for each deleted key prints out its recovery id.

+ * {@codesnippet com.azure.keyvault.keys.keyclient.listDeletedKeys#Context} + * + * @param context Additional context that is passed through the Http pipeline during the service call. + * @return A {@link List} containing all of the {@link DeletedKey deleted keys} in the vault. + */ + public Iterable listDeletedKeys(Context context) { + return client.listDeletedKeys(context).toIterable(); + } + /** * List all versions of the specified key. The individual key response in the flux is represented by {@link KeyBase} * as only the base key identifier, attributes and tags are provided in the response. The key material values are @@ -521,4 +765,23 @@ public Iterable listDeletedKeys() { public Iterable listKeyVersions(String name) { return client.listKeyVersions(name).toIterable(); } + + /** + * List all versions of the specified key. The individual key response in the flux is represented by {@link KeyBase} + * as only the base key identifier, attributes and tags are provided in the response. The key material values are + * not provided in the response. This operation requires the {@code keys/list} permission. + * + *

It is possible to get full keys with key material for each version from this information. Loop over the {@link KeyBase key} and + * call {@link KeyClient#getKey(KeyBase baseKey)} . This will return the {@link Key keys} with key material included of the specified versions.

+ * {@codesnippet com.azure.keyvault.keys.keyclient.listKeyVersions} + * + * @param name The name of the key. + * @param context Additional context that is passed through the Http pipeline during the service call. + * @throws ResourceNotFoundException when a key with {@code name} doesn't exist in the key vault. + * @throws HttpRequestException when a key with {@code name} is empty string. + * @return A {@link List} containing {@link KeyBase key} of all the versions of the specified key in the vault. List is empty if key with {@code name} does not exist in key vault. + */ + public Iterable listKeyVersions(String name, Context context) { + return client.listKeyVersions(name, context).toIterable(); + } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClientBuilder.java b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClientBuilder.java index 63cf4e554a5f8..b5c9acfe8ee3c 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClientBuilder.java +++ b/sdk/keyvault/azure-keyvault-keys/src/main/java/com/azure/security/keyvault/keys/KeyClientBuilder.java @@ -3,6 +3,8 @@ package com.azure.security.keyvault.keys; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; import com.azure.core.implementation.util.ImplUtils; import com.azure.core.util.configuration.Configuration; import com.azure.core.credentials.TokenCredential; @@ -88,6 +90,7 @@ public KeyClientBuilder() { public KeyClient buildClient() { return new KeyClient(buildAsyncClient()); } + /** * Creates a {@link KeyAsyncClient} based on options set in the builder. * Every time {@code buildAsyncClient()} is called, a new instance of {@link KeyAsyncClient} is created. @@ -121,12 +124,14 @@ public KeyAsyncClient buildAsyncClient() { // Closest to API goes first, closest to wire goes last. final List policies = new ArrayList<>(); policies.add(new UserAgentPolicy(AzureKeyVaultConfiguration.SDK_NAME, AzureKeyVaultConfiguration.SDK_VERSION, buildConfiguration)); + HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new BearerTokenAuthenticationPolicy(credential, KeyAsyncClient.KEY_VAULT_SCOPE)); policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); policies.add(new HttpLoggingPolicy(httpLogDetailLevel)); - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperations.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperations.java index e54ebdad9d157..e35dcb2a91251 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperations.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperations.java @@ -45,7 +45,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // Backups are good to have, if in case keys get accidentally deleted by you. // For long term storage, it is ideal to write the backup to a file. String backupFilePath = "YOUR_BACKUP_FILE_PATH"; - byte[] keyBackup = keyClient.backupKey("CloudRsaKey").value(); + byte[] keyBackup = keyClient.backupKey("CloudRsaKey"); writeBackupToFile(keyBackup, backupFilePath); // The Cloud Rsa key is no longer in use, so you delete it. @@ -62,7 +62,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // After sometime, the key is required again. We can use the backup value to restore it in the key vault. byte[] backupFromFile = Files.readAllBytes(new File(backupFilePath).toPath()); - Key restoredKey = keyClient.restoreKey(backupFromFile).value(); + Key restoredKey = keyClient.restoreKey(backupFromFile); } private static void writeBackupToFile(byte[] bytes, String filePath) { diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperationsAsync.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperationsAsync.java index c1b1191e861e9..9fa280a6d3558 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperationsAsync.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/BackupAndRestoreOperationsAsync.java @@ -41,7 +41,7 @@ public static void main(String[] args) throws IOException, InterruptedException, .expires(OffsetDateTime.now().plusYears(1)) .keySize(2048)) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); Thread.sleep(2000); @@ -49,7 +49,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // For long term storage, it is ideal to write the backup to a file. String backupFilePath = "YOUR_BACKUP_FILE_PATH"; keyAsyncClient.backupKey("CloudRsaKey").subscribe(backupResponse -> { - byte[] backupBytes = backupResponse.value(); + byte[] backupBytes = backupResponse; writeBackupToFile(backupBytes, backupFilePath); }); @@ -57,7 +57,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // The Cloud Rsa key is no longer in use, so you delete it. keyAsyncClient.deleteKey("CloudRsaKey").subscribe(deletedKeyResponse -> - System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.value().recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.recoveryId())); //To ensure file is deleted on server side. Thread.sleep(30000); @@ -72,7 +72,7 @@ public static void main(String[] args) throws IOException, InterruptedException, // After sometime, the key is required again. We can use the backup value to restore it in the key vault. byte[] backupFromFile = Files.readAllBytes(new File(backupFilePath).toPath()); keyAsyncClient.restoreKey(backupFromFile).subscribe(keyResponse -> - System.out.printf("Restored Key with name %s \n", keyResponse.value().name())); + System.out.printf("Restored Key with name %s \n", keyResponse.name())); //To ensure key is restored on server side. Thread.sleep(15000); diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorld.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorld.java index c9b3a3866ed80..50b5e387cf027 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorld.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorld.java @@ -38,13 +38,14 @@ public static void main(String[] args) throws InterruptedException, IllegalArgum .keySize(2048)); // Let's Get the Cloud Rsa Key from the key vault. - Key cloudRsaKey = keyClient.getKey("CloudRsaKey").value(); - System.out.printf("Key is returned with name %s and type %s \n", cloudRsaKey.name(), cloudRsaKey.keyMaterial().kty()); + Key cloudRsaKey = keyClient.getKey("CloudRsaKey"); + System.out.printf("Key is returned with name %s and type %s \n", cloudRsaKey.name(), + cloudRsaKey.keyMaterial().kty()); // After one year, the Cloud Rsa Key is still required, we need to update the expiry time of the key. // The update method can be used to update the expiry attribute of the key. cloudRsaKey.expires(cloudRsaKey.expires().plusYears(1)); - Key updatedKey = keyClient.updateKey(cloudRsaKey).value(); + Key updatedKey = keyClient.updateKey(cloudRsaKey); System.out.printf("Key's updated expiry time %s \n", updatedKey.expires()); // We need the Cloud Rsa key with bigger key size, so you want to update the key in key vault to ensure it has the required size. diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorldAsync.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorldAsync.java index 257b79b48c500..922548455aecf 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorldAsync.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/HelloWorldAsync.java @@ -36,13 +36,13 @@ public static void main(String[] args) throws InterruptedException { .expires(OffsetDateTime.now().plusYears(1)) .keySize(2048)) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); Thread.sleep(2000); // Let's Get the Cloud Rsa Key from the key vault. keyAsyncClient.getKey("CloudRsaKey").subscribe(keyResponse -> - System.out.printf("Key returned with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); + System.out.printf("Key returned with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); Thread.sleep(2000); @@ -50,11 +50,11 @@ public static void main(String[] args) throws InterruptedException { // After one year, the Cloud Rsa Key is still required, we need to update the expiry time of the key. // The update method can be used to update the expiry attribute of the key. keyAsyncClient.getKey("CloudRsaKey").subscribe(keyResponse -> { - Key key = keyResponse.value(); + Key key = keyResponse; //Update the expiry time of the key. key.expires(key.expires().plusYears(1)); keyAsyncClient.updateKey(key).subscribe(updatedKeyResponse -> - System.out.printf("Key's updated expiry time %s \n", updatedKeyResponse.value().expires().toString())); + System.out.printf("Key's updated expiry time %s \n", updatedKeyResponse.expires().toString())); }); Thread.sleep(2000); @@ -65,13 +65,13 @@ public static void main(String[] args) throws InterruptedException { .expires(OffsetDateTime.now().plusYears(1)) .keySize(4096)) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); Thread.sleep(2000); // The Cloud Rsa Key is no longer needed, need to delete it from the key vault. keyAsyncClient.deleteKey("CloudRsaKey").subscribe(deletedKeyResponse -> - System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.value().recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.recoveryId())); //To ensure key is deleted on server side. Thread.sleep(30000); diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyAsyncClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyAsyncClientJavaDocCodeSnippets.java new file mode 100644 index 0000000000000..12eacca66a16d --- /dev/null +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyAsyncClientJavaDocCodeSnippets.java @@ -0,0 +1,496 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.security.keyvault.keys; + +import com.azure.core.credentials.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.test.models.RecordedData; +import com.azure.core.test.policy.RecordNetworkCallPolicy; +import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.security.keyvault.keys.models.EcKeyCreateOptions; +import com.azure.security.keyvault.keys.models.Key; +import com.azure.security.keyvault.keys.models.KeyBase; +import com.azure.security.keyvault.keys.models.KeyCreateOptions; +import com.azure.security.keyvault.keys.models.RsaKeyCreateOptions; +import com.azure.security.keyvault.keys.models.webkey.KeyCurveName; +import com.azure.security.keyvault.keys.models.webkey.KeyOperation; +import com.azure.security.keyvault.keys.models.webkey.KeyType; +import reactor.util.context.Context; + +import java.time.OffsetDateTime; + +/** + * This class contains code samples for generating javadocs through doclets for {@link KeyAsyncClient} + */ +public final class KeyAsyncClientJavaDocCodeSnippets { + + private String key1 = "key1"; + private String key2 = "key2"; + private String value1 = "val1"; + private String value2 = "val2"; + + /** + * Generates code sample for creating a {@link KeyAsyncClient} + * @return An instance of {@link KeyAsyncClient} + */ + public KeyAsyncClient createAsyncClientWithHttpClient() { + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.withhttpclient.instantiation + RecordedData networkData = new RecordedData(); + KeyAsyncClient keyAsyncClient = new KeyClientBuilder() + .endpoint("https://myvault.azure.net/") + .credential(new DefaultAzureCredential()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .addPolicy(new RecordNetworkCallPolicy(networkData)) + .httpClient(HttpClient.createDefault()) + .buildAsyncClient(); + // END: com.azure.security.keyvault.keys.async.keyclient.withhttpclient.instantiation + return keyAsyncClient; + } + + /** + * Generates code sample for creating a {@link KeyAsyncClient} + * @return An instance of {@link KeyAsyncClient} + */ + public KeyAsyncClient createAsyncClient() { + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.instantiation + KeyAsyncClient keyAsyncClient = new KeyClientBuilder() + .endpoint("https://myvault.azure.net/") + .credential(new DefaultAzureCredential()) + .buildAsyncClient(); + // END: com.azure.security.keyvault.keys.async.keyclient.instantiation + return keyAsyncClient; + } + + /** + * Generates code sample for creating a {@link KeyAsyncClient} + * @return An instance of {@link KeyAsyncClient} + */ + public KeyAsyncClient createAsyncClientWithPipeline() { + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.pipeline.instantiation + RecordedData networkData = new RecordedData(); + HttpPipeline pipeline = new HttpPipelineBuilder().policies(new RecordNetworkCallPolicy(networkData)).build(); + KeyAsyncClient keyAsyncClient = new KeyClientBuilder() + .pipeline(pipeline) + .endpoint("https://myvault.azure.net/") + .credential(new DefaultAzureCredential()) + .buildAsyncClient(); + // END: com.azure.security.keyvault.keys.async.keyclient.pipeline.instantiation + return keyAsyncClient; + } + + + /** + * Generates a code sample for using {@link KeyAsyncClient#createKey(String, KeyType)} + */ + public void createKey() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createKey#string-keyType + keyAsyncClient.createKey("keyName", KeyType.EC) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.name(), keyResponse.id())); + // END: com.azure.security.keyvault.keys.async.keyclient.createKey#string-keyType + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createKey#keyCreateOptions + KeyCreateOptions keyCreateOptions = new KeyCreateOptions("keyName", KeyType.RSA) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + keyAsyncClient.createKey(keyCreateOptions) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.name(), keyResponse.id())); + // END: com.azure.security.keyvault.keys.async.keyclient.createKey#keyCreateOptions + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createRsaKey#RsaKeyCreateOptions + RsaKeyCreateOptions rsaKeyCreateOptions = new RsaKeyCreateOptions("keyName") + .keySize(2048) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + keyAsyncClient.createRsaKey(rsaKeyCreateOptions) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.name(), keyResponse.id())); + // END: com.azure.security.keyvault.keys.async.keyclient.createRsaKey#RsaKeyCreateOptions + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createEcKey#EcKeyCreateOptions + EcKeyCreateOptions ecKeyCreateOptions = new EcKeyCreateOptions("keyName") + .curve(KeyCurveName.P_384) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + keyAsyncClient.createEcKey(ecKeyCreateOptions) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.name(), keyResponse.id())); + // END: com.azure.security.keyvault.keys.async.keyclient.createEcKey#EcKeyCreateOptions + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#deleteKey(String)} + */ + public void deleteKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.deleteKey#string + keyAsyncClient.deleteKey("keyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Deleted Key's Recovery Id %s", keyResponse.recoveryId())); + // END: com.azure.security.keyvault.keys.async.keyclient.deleteKey#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#getDeletedKey(String)} + */ + public void getDeletedKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.getDeletedKey#string + keyAsyncClient.getDeletedKey("keyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Deleted Key's Recovery Id %s", keyResponse.recoveryId())); + // END: com.azure.security.keyvault.keys.async.keyclient.getDeletedKey#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#createKeyWithResponse(KeyCreateOptions)} + */ + public void createKeyWithResponses() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createKeyWithResponse#keyCreateOptions + KeyCreateOptions keyCreateOptions = new KeyCreateOptions("keyName", KeyType.RSA) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + keyAsyncClient.createKeyWithResponse(keyCreateOptions) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.value().name(), + keyResponse.value().id())); + // END: com.azure.security.keyvault.keys.async.keyclient.createKeyWithResponse#keyCreateOptions + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createRsaKeyWithResponse#RsaKeyCreateOptions + RsaKeyCreateOptions rsaKeyCreateOptions = new RsaKeyCreateOptions("keyName") + .keySize(2048) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + keyAsyncClient.createRsaKeyWithResponse(rsaKeyCreateOptions) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.value().name(), + keyResponse.value().id())); + // END: com.azure.security.keyvault.keys.async.keyclient.createRsaKeyWithResponse#RsaKeyCreateOptions + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.createEcKeyWithResponse#EcKeyCreateOptions + EcKeyCreateOptions ecKeyCreateOptions = new EcKeyCreateOptions("keyName") + .curve(KeyCurveName.P_384) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + keyAsyncClient.createEcKeyWithResponse(ecKeyCreateOptions) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.value().name(), + keyResponse.value().id())); + // END: com.azure.security.keyvault.keys.async.keyclient.createEcKeyWithResponse#EcKeyCreateOptions + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#getKeyWithResponse(String, String)} + */ + public void getKeyWithResponseSnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#string-string + String keyVersion = "6A385B124DEF4096AF1361A85B16C204"; + keyAsyncClient.getKeyWithResponse("keyName", keyVersion) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", + keyResponse.value().name(), keyResponse.value().id())); + // END: com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#string-string + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#string + keyAsyncClient.getKeyWithResponse("keyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", + keyResponse.value().name(), keyResponse.value().id())); + // END: com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#string + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#KeyBase + keyAsyncClient.listKeys().subscribe(keyBase -> + keyAsyncClient.getKeyWithResponse(keyBase) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key with name %s and value %s \n", keyResponse.value().name(), + keyResponse.value().id()))); + // END: com.azure.security.keyvault.keys.async.keyclient.getKeyWithResponse#KeyBase + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#getKey(String, String)} + */ + public void getKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.getKey#string-string + String keyVersion = "6A385B124DEF4096AF1361A85B16C204"; + keyAsyncClient.getKey("keyName", keyVersion) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.name(), keyResponse.id())); + // END: com.azure.security.keyvault.keys.async.keyclient.getKey#string-string + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.getKey#string + keyAsyncClient.getKey("keyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key is created with name %s and id %s \n", keyResponse.name(), keyResponse.id())); + // END: com.azure.security.keyvault.keys.async.keyclient.getKey#string + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.getKey#KeyBase + keyAsyncClient.listKeys().subscribe(keyBase -> + keyAsyncClient.getKey(keyBase) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Key with name %s and value %s \n", keyResponse.name(), keyResponse.id()))); + // END: com.azure.security.keyvault.keys.async.keyclient.getKey#KeyBase + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#updateKeyWithResponse(KeyBase, KeyOperation...)} + */ + public void updateKeyWithResponseSnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.updateKeyWithResponse#KeyBase-keyOperations + keyAsyncClient.getKeyWithResponse("keyName") + .subscribe(keyResponse -> { + Key key = keyResponse.value(); + //Update the not before time of the key. + key.notBefore(OffsetDateTime.now().plusDays(50)); + keyAsyncClient.updateKeyWithResponse(key, KeyOperation.ENCRYPT, KeyOperation.DECRYPT) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(updatedKeyResponse -> + System.out.printf("Key's updated not before time %s \n", + updatedKeyResponse.value().notBefore().toString())); + }); + // END: com.azure.security.keyvault.keys.async.keyclient.updateKeyWithResponse#KeyBase-keyOperations + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.updateKeyWithResponse#KeyBase + keyAsyncClient.getKeyWithResponse("keyName") + .subscribe(keyResponse -> { + Key key = keyResponse.value(); + //Update the not before time of the key. + key.notBefore(OffsetDateTime.now().plusDays(50)); + keyAsyncClient.updateKeyWithResponse(key) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(updatedKeyResponse -> + System.out.printf("Key's updated not before time %s \n", + updatedKeyResponse.value().notBefore().toString())); + }); + // END: com.azure.security.keyvault.keys.async.keyclient.updateKeyWithResponse#KeyBase + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#updateKey(KeyBase, KeyOperation...)} + */ + public void updateKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.updateKey#KeyBase-keyOperations + keyAsyncClient.getKey("keyName") + .subscribe(keyResponse -> { + //Update the not before time of the key. + keyResponse.notBefore(OffsetDateTime.now().plusDays(50)); + keyAsyncClient.updateKey(keyResponse, KeyOperation.ENCRYPT, KeyOperation.DECRYPT) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(updatedKeyResponse -> + System.out.printf("Key's updated not before time %s \n", + updatedKeyResponse.notBefore().toString())); + }); + // END: com.azure.security.keyvault.keys.async.keyclient.updateKey#KeyBase-keyOperations + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.updateKey#KeyBase + keyAsyncClient.getKey("keyName") + .subscribe(keyResponse -> { + //Update the not before time of the key. + keyResponse.notBefore(OffsetDateTime.now().plusDays(50)); + keyAsyncClient.updateKey(keyResponse) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(updatedKeyResponse -> + System.out.printf("Key's updated not before time %s \n", + updatedKeyResponse.notBefore().toString())); + }); + // END: com.azure.security.keyvault.keys.async.keyclient.updateKey#KeyBase + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#deleteKeyWithResponse(String)} + */ + public void deleteKeyWithResponseSnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.deleteKeyWithResponse#string + keyAsyncClient.deleteKeyWithResponse("keyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedKeyResponse -> + System.out.printf("Deleted Key's Recovery Id %s", deletedKeyResponse.value().recoveryId())); + // END: com.azure.security.keyvault.keys.async.keyclient.deleteKeyWithResponse#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#getDeletedKeyWithResponse(String)} + */ + public void getDeleteKeyWithResponseSnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.getDeletedKeyWithResponse#string + keyAsyncClient.getDeletedKeyWithResponse("keyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedKeyResponse -> + System.out.printf("Deleted Key's Recovery Id %s", deletedKeyResponse.value().recoveryId())); + // END: com.azure.security.keyvault.keys.async.keyclient.getDeletedKeyWithResponse#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#purgeDeletedKey(String)} + */ + public void purgeDeletedKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.purgeDeletedKey#string + keyAsyncClient.purgeDeletedKey("deletedKeyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(purgeResponse -> + System.out.printf("Purge Status response %rsaPrivateExponent \n", purgeResponse.statusCode())); + // END: com.azure.security.keyvault.keys.async.keyclient.purgeDeletedKey#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#recoverDeletedKeyWithResponse(String)} + */ + public void recoverDeletedKeyWithResponseSnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.recoverDeletedKeyWithResponse#string + keyAsyncClient.recoverDeletedKeyWithResponse("deletedKeyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(recoveredKeyResponse -> + System.out.printf("Recovered Key with name %s \n", recoveredKeyResponse.value().name())); + // END: com.azure.security.keyvault.keys.async.keyclient.recoverDeletedKeyWithResponse#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#recoverDeletedKey(String)} + */ + public void recoverDeletedKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.recoverDeletedKey#string + keyAsyncClient.recoverDeletedKey("deletedKeyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(recoveredKeyResponse -> + System.out.printf("Recovered Key with name %s \n", recoveredKeyResponse.name())); + // END: com.azure.security.keyvault.keys.async.keyclient.recoverDeletedKey#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#backupKey(String)} + */ + public void backupKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.backupKey#string + keyAsyncClient.backupKey("keyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyBackupResponse -> + System.out.printf("Key's Backup Byte array's length %s \n", keyBackupResponse.length)); + // END: com.azure.security.keyvault.keys.async.keyclient.backupKey#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#backupKeyWithResponse(String)} + */ + public void backupKeyWithResponseSnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.backupKeyWithResponse#string + keyAsyncClient.backupKeyWithResponse("keyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyBackupResponse -> + System.out.printf("Key's Backup Byte array's length %s \n", keyBackupResponse.value().length)); + // END: com.azure.security.keyvault.keys.async.keyclient.backupKeyWithResponse#string + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#restoreKey} + */ + public void restoreKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.restoreKey#byte + byte[] keyBackupByteArray = {}; + keyAsyncClient.restoreKey(keyBackupByteArray) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Restored Key with name %s and id %s \n", keyResponse.name(), keyResponse.id())); + // END: com.azure.security.keyvault.keys.async.keyclient.restoreKey#byte + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#restoreKeyWithResponse(byte[])} + */ + public void restoreKeyWithResponseSnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.restoreKeyWithResponse#byte + byte[] keyBackupByteArray = {}; + keyAsyncClient.restoreKeyWithResponse(keyBackupByteArray) + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyResponse -> + System.out.printf("Restored Key with name %s and id %s \n", keyResponse.value().name(), + keyResponse.value().id())); + // END: com.azure.security.keyvault.keys.async.keyclient.restoreKeyWithResponse#byte + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#listKeys} + */ + public void listKeySnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.listKeys + keyAsyncClient.listKeys() + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyBase -> keyAsyncClient.getKey(keyBase) + .subscribe(keyResponse -> System.out.printf("Received key with name %s and type %s", keyResponse.name(), + keyResponse.keyMaterial().kty()))); + // END: com.azure.security.keyvault.keys.async.keyclient.listKeys + } + + /** + * Generates a code sample for using {@link KeyAsyncClient#listDeletedKeys} + */ + public void listDeletedKeysSnippets() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.listDeletedKeys + keyAsyncClient.listDeletedKeys() + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(deletedKey -> System.out.printf("Deleted key's recovery Id %s", deletedKey.recoveryId())); + // END: com.azure.security.keyvault.keys.async.keyclient.listDeletedKeys + } + + /** + * Generates code sample for using {@link KeyAsyncClient#listKeyVersions(String)} + */ + public void listKeyVersions() { + KeyAsyncClient keyAsyncClient = createAsyncClient(); + // BEGIN: com.azure.security.keyvault.keys.async.keyclient.listKeyVersions + keyAsyncClient.listKeyVersions("keyName") + .subscriberContext(Context.of(key1, value1, key2, value2)) + .subscribe(keyBase -> keyAsyncClient.getKey(keyBase) + .subscribe(keyResponse -> + System.out.printf("Received key's version with name %s, type %s and version %s", keyResponse.name(), + keyResponse.keyMaterial().kty(), keyResponse.version()))); + // END: com.azure.security.keyvault.keys.async.keyclient.listKeyVersions + } + + /** + * Implementation not provided for this method + * @return {@code null} + */ + private TokenCredential getKeyVaultCredential() { + return null; + } +} diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java index 6f63be8f59b68..c2e2caedfee11 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/KeyClientJavaDocCodeSnippets.java @@ -6,36 +6,33 @@ import com.azure.core.credentials.TokenCredential; import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.test.models.RecordedData; -import com.azure.core.test.policy.RecordNetworkCallPolicy; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; import com.azure.identity.credential.DefaultAzureCredential; +import com.azure.security.keyvault.keys.models.DeletedKey; +import com.azure.security.keyvault.keys.models.EcKeyCreateOptions; import com.azure.security.keyvault.keys.models.Key; import com.azure.security.keyvault.keys.models.KeyBase; +import com.azure.security.keyvault.keys.models.KeyCreateOptions; +import com.azure.security.keyvault.keys.models.RsaKeyCreateOptions; +import com.azure.security.keyvault.keys.models.webkey.KeyCurveName; +import com.azure.security.keyvault.keys.models.webkey.KeyOperation; import com.azure.security.keyvault.keys.models.webkey.KeyType; +import java.time.OffsetDateTime; + /** * This class contains code samples for generating javadocs through doclets for {@link KeyClient} */ public final class KeyClientJavaDocCodeSnippets { - /** - * Generates code sample for creating a {@link KeyAsyncClient} - * @return An instance of {@link KeyAsyncClient} - */ - public KeyAsyncClient createAsyncClientWithHttpClient() { - // BEGIN: com.azure.security.keyvault.keys.async.keyclient.withhttpclient.instantiation - RecordedData networkData = new RecordedData(); - KeyAsyncClient keyClient = new KeyClientBuilder() - .endpoint("https://myvault.azure.net/") - .credential(new DefaultAzureCredential()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(new RecordNetworkCallPolicy(networkData)) - .httpClient(HttpClient.createDefault()) - .buildAsyncClient(); - // END: com.azure.security.keyvault.keys.async.keyclient.withhttpclient.instantiation - return keyClient; - } + private String key1 = "key1"; + private String key2 = "key2"; + private String value1 = "val1"; + private String value2 = "val2"; /** * Generates code sample for creating a {@link KeyClient} @@ -52,46 +49,323 @@ public KeyClient createClient() { } /** - * Generates code sample for creating a {@link KeyAsyncClient} - * @return An instance of {@link KeyAsyncClient} + * Generates a code sample for using {@link KeyClient#createKey(String, KeyType)} */ - public KeyAsyncClient createAsyncClient() { - // BEGIN: com.azure.security.keyvault.keys.async.keyclient.instantiation - KeyAsyncClient keyClient = new KeyClientBuilder() - .endpoint("https://myvault.azure.net/") - .credential(new DefaultAzureCredential()) - .buildAsyncClient(); - // END: com.azure.security.keyvault.keys.async.keyclient.instantiation - return keyClient; + public void createKey() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.createKey#string-keyType + Key key = keyClient.createKey("keyName", KeyType.EC); + System.out.printf("Key is created with name %s and id %s %n", key.name(), key.id()); + // END: com.azure.keyvault.keys.keyclient.createKey#string-keyType + + // BEGIN: com.azure.keyvault.keys.keyclient.createKey#keyOptions + KeyCreateOptions keyCreateOptions = new KeyCreateOptions("keyName", KeyType.RSA) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + Key optionsKey = keyClient.createKey(keyCreateOptions); + System.out.printf("Key is created with name %s and id %s \n", optionsKey.name(), optionsKey.id()); + // END: com.azure.keyvault.keys.keyclient.createKey#keyOptions + + // BEGIN: com.azure.keyvault.keys.keyclient.createRsaKey#keyOptions + RsaKeyCreateOptions rsaKeyCreateOptions = new RsaKeyCreateOptions("keyName") + .keySize(2048) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + Key rsaKey = keyClient.createRsaKey(rsaKeyCreateOptions); + System.out.printf("Key is created with name %s and id %s \n", rsaKey.name(), rsaKey.id()); + // END: com.azure.keyvault.keys.keyclient.createRsaKey#keyOptions + + // BEGIN: com.azure.keyvault.keys.keyclient.createEcKey#keyOptions + EcKeyCreateOptions ecKeyCreateOptions = new EcKeyCreateOptions("keyName") + .curve(KeyCurveName.P_384) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + Key ecKey = keyClient.createEcKey(ecKeyCreateOptions); + System.out.printf("Key is created with name %s and id %s \n", ecKey.name(), ecKey.id()); + // END: com.azure.keyvault.keys.keyclient.createEcKey#keyOptions + + } /** - * Generates code sample for creating a {@link KeyAsyncClient} - * @return An instance of {@link KeyAsyncClient} + * Generates a code sample for using {@link KeyClient#deleteKey(String)} */ - public KeyAsyncClient createAsyncClientWithPipeline() { - // BEGIN: com.azure.security.keyvault.keys.async.keyclient.pipeline.instantiation - RecordedData networkData = new RecordedData(); - HttpPipeline pipeline = HttpPipeline.builder().policies(new RecordNetworkCallPolicy(networkData)).build(); - KeyAsyncClient keyClient = new KeyClientBuilder() - .pipeline(pipeline) - .endpoint("https://myvault.azure.net/") - .credential(new DefaultAzureCredential()) - .buildAsyncClient(); - // END: com.azure.security.keyvault.keys.async.keyclient.pipeline.instantiation - return keyClient; + public void deleteKeySnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.deleteKey#string + Key key = keyClient.getKey("keyName"); + DeletedKey deletedKey = keyClient.deleteKey("keyName"); + System.out.printf("Deleted Key's Recovery Id %s", deletedKey.recoveryId()); + // END: com.azure.keyvault.keys.keyclient.deleteKey#string } + /** + * Generates a code sample for using {@link KeyClient#getDeletedKey(String)} + */ + public void getDeletedKeySnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.getDeletedKey#string + DeletedKey deletedKey = keyClient.getDeletedKey("keyName"); + System.out.printf("Deleted Key's Recovery Id %s", deletedKey.recoveryId()); + // END: com.azure.keyvault.keys.keyclient.getDeletedKey#string + } /** - * Generates a code sample for using {@link KeyClient#createKey(String, KeyType)} + * Generates a code sample for using {@link KeyClient#createKeyWithResponse(KeyCreateOptions, Context)} */ - public void createKey() { + public void createKeyWithResponses() { KeyClient keyClient = createClient(); - // BEGIN: com.azure.keyvault.keys.keyclient.createKey#string-keyType - Key retKey = keyClient.createKey("keyName", KeyType.EC).value(); - System.out.printf("Key is created with name %s and id %s %n", retKey.name(), retKey.id()); - // END: com.azure.keyvault.keys.keyclient.createKey#string-keyType + // BEGIN: com.azure.keyvault.keys.keyclient.createKeyWithResponse#keyCreateOptions-Context + KeyCreateOptions keyCreateOptions = new KeyCreateOptions("keyName", KeyType.RSA) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + Key optionsKey = keyClient.createKeyWithResponse(keyCreateOptions, new Context(key1, value1)).value(); + System.out.printf("Key is created with name %s and id %s \n", optionsKey.name(), optionsKey.id()); + // END: com.azure.keyvault.keys.keyclient.createKeyWithResponse#keyCreateOptions-Context + + // BEGIN: com.azure.keyvault.keys.keyclient.createRsaKeyWithResponse#keyOptions + RsaKeyCreateOptions rsaKeyCreateOptions = new RsaKeyCreateOptions("keyName") + .keySize(2048) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + Key rsaKey = keyClient.createRsaKeyWithResponse(rsaKeyCreateOptions, new Context(key1, value1)).value(); + System.out.printf("Key is created with name %s and id %s \n", rsaKey.name(), rsaKey.id()); + // END: com.azure.keyvault.keys.keyclient.createRsaKeyWithResponse#keyOptions + + // BEGIN: com.azure.keyvault.keys.keyclient.createEcKeyWithResponse#keyOptions + EcKeyCreateOptions ecKeyCreateOptions = new EcKeyCreateOptions("keyName") + .curve(KeyCurveName.P_384) + .notBefore(OffsetDateTime.now().plusDays(1)) + .expires(OffsetDateTime.now().plusYears(1)); + Key ecKey = keyClient.createEcKeyWithResponse(ecKeyCreateOptions, new Context(key1, value1)).value(); + System.out.printf("Key is created with name %s and id %s \n", ecKey.name(), ecKey.id()); + // END: com.azure.keyvault.keys.keyclient.createEcKeyWithResponse#keyOptions + } + + /** + * Generates a code sample for using {@link KeyClient#getKeyWithResponse(String, String, Context)} + */ + public void getKeyWithResponseSnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.getKeyWithResponse#string-string-Context + String keyVersion = "6A385B124DEF4096AF1361A85B16C204"; + Key keyWithVersion = keyClient.getKeyWithResponse("keyName", keyVersion, + new Context(key1, value1)).value(); + System.out.printf("Key is returned with name %s and id %s \n", keyWithVersion.name(), keyWithVersion.id()); + // END: com.azure.keyvault.keys.keyclient.getKeyWithResponse#string-string-Context + } + + /** + * Generates a code sample for using {@link KeyClient#getKey(String, String)} + */ + public void getKeySnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.getKey#string-string + String keyVersion = "6A385B124DEF4096AF1361A85B16C204"; + Key keyWithVersion = keyClient.getKey("keyName", keyVersion); + System.out.printf("Key is returned with name %s and id %s \n", keyWithVersion.name(), keyWithVersion.id()); + // END: com.azure.keyvault.keys.keyclient.getKey#string-string + + // BEGIN: com.azure.keyvault.keys.keyclient.getKey#string + Key keyWithVersionValue = keyClient.getKey("keyName"); + System.out.printf("Key is returned with name %s and id %s \n", keyWithVersionValue.name(), keyWithVersionValue.id()); + // END: com.azure.keyvault.keys.keyclient.getKey#string + + // BEGIN: com.azure.keyvault.keys.keyclient.getKey#KeyBase + for (KeyBase key : keyClient.listKeys()) { + Key keyResponse = keyClient.getKey(key); + System.out.printf("Received key with name %s and type %s", keyResponse.name(), + keyResponse.keyMaterial().kty()); + } + // END: com.azure.keyvault.keys.keyclient.getKey#KeyBase + } + + /** + * Generates a code sample for using {@link KeyClient#updateKeyWithResponse(KeyBase, Context, KeyOperation...)} + */ + public void updateKeyWithResponseSnippets() { + KeyClient keyClient = createClient(); + + // BEGIN: com.azure.keyvault.keys.keyclient.updateKeyWithResponse#KeyBase-keyOperations-Context + Key key = keyClient.getKey("keyName"); + key.expires(OffsetDateTime.now().plusDays(60)); + KeyBase updatedKeyBase = keyClient.updateKeyWithResponse(key, + new Context(key1, value1), KeyOperation.ENCRYPT, KeyOperation.DECRYPT).value(); + Key updatedKey = keyClient.getKey(updatedKeyBase.name()); + System.out.printf("Key is updated with name %s and id %s \n", updatedKey.name(), updatedKey.id()); + // END: com.azure.keyvault.keys.keyclient.updateKeyWithResponse#KeyBase-keyOperations-Context + } + + /** + * Generates a code sample for using {@link KeyClient#updateKey(KeyBase, KeyOperation...)} + */ + public void updateKeySnippets() { + KeyClient keyClient = createClient(); + + // BEGIN: com.azure.keyvault.keys.keyclient.updateKey#KeyBase-keyOperations + Key key = keyClient.getKey("keyName"); + key.expires(OffsetDateTime.now().plusDays(60)); + KeyBase updatedKeyBase = keyClient.updateKey(key, KeyOperation.ENCRYPT, KeyOperation.DECRYPT); + Key updatedKey = keyClient.getKey(updatedKeyBase.name()); + System.out.printf("Key is updated with name %s and id %s \n", updatedKey.name(), updatedKey.id()); + // END: com.azure.keyvault.keys.keyclient.updateKey#KeyBase-keyOperations + + // BEGIN: com.azure.keyvault.keys.keyclient.updateKey#KeyBase + Key updateKey = keyClient.getKey("keyName"); + key.expires(OffsetDateTime.now().plusDays(60)); + KeyBase updatedKeyBaseValue = keyClient.updateKey(updateKey); + Key updatedKeyValue = keyClient.getKey(updatedKeyBaseValue.name()); + System.out.printf("Key is updated with name %s and id %s \n", updatedKeyValue.name(), updatedKeyValue.id()); + // END: com.azure.keyvault.keys.keyclient.updateKey#KeyBase + } + + /** + * Generates a code sample for using {@link KeyClient#deleteKeyWithResponse(String, Context)} + */ + public void deleteKeyWithResponseSnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.deleteKeyWithResponse#string-Context + Key key = keyClient.getKey("keyName"); + DeletedKey deletedKey = keyClient.deleteKeyWithResponse("keyName", new Context(key1, value1)).value(); + System.out.printf("Deleted Key's Recovery Id %s", deletedKey.recoveryId()); + // END: com.azure.keyvault.keys.keyclient.deleteKeyWithResponse#string-Context + } + + /** + * Generates a code sample for using {@link KeyClient#getDeletedKeyWithResponse(String, Context)} + */ + public void getDeleteKeyWithResponseSnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.getDeletedKeyWithResponse#string-Context + DeletedKey deletedKey = keyClient.getDeletedKeyWithResponse("keyName", new Context(key1, value1)).value(); + System.out.printf("Deleted Key with recovery Id %s \n", deletedKey.recoveryId()); + // END: com.azure.keyvault.keys.keyclient.getDeletedKeyWithResponse#string-Context + } + + /** + * Generates a code sample for using {@link KeyClient#purgeDeletedKey(String)} + */ + public void purgeDeletedKeySnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.purgeDeletedKey#string + VoidResponse purgeResponse = keyClient.purgeDeletedKey("deletedKeyName"); + System.out.printf("Purge Status Code: %rsaPrivateExponent", purgeResponse.statusCode()); + // END: com.azure.keyvault.keys.keyclient.purgeDeletedKey#string + + // BEGIN: com.azure.keyvault.keys.keyclient.purgeDeletedKey#string-Context + VoidResponse purgedResponse = keyClient.purgeDeletedKey("deletedKeyName", new Context(key2, value2)); + System.out.printf("Purge Status Code: %rsaPrivateExponent", purgedResponse.statusCode()); + // END: com.azure.keyvault.keys.keyclient.purgeDeletedKey#string-Context + } + + /** + * Generates a code sample for using {@link KeyClient#recoverDeletedKeyWithResponse(String, Context)} + */ + public void recoverDeletedKeyWithResponseSnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.recoverDeletedKeyWithResponse#string-Context + Key recoveredKey = keyClient.recoverDeletedKeyWithResponse("deletedKeyName", + new Context(key2, value2)).value(); + System.out.printf("Recovered key with name %s", recoveredKey.name()); + // END: com.azure.keyvault.keys.keyclient.recoverDeletedKeyWithResponse#string-Context + } + + /** + * Generates a code sample for using {@link KeyClient#recoverDeletedKey(String)} + */ + public void recoverDeletedKeySnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.recoverDeletedKey#string + Key recoveredKey = keyClient.recoverDeletedKey("deletedKeyName"); + System.out.printf("Recovered key with name %s", recoveredKey.name()); + // END: com.azure.keyvault.keys.keyclient.recoverDeletedKey#string + } + + /** + * Generates a code sample for using {@link KeyClient#backupKey(String)} + */ + public void backupKeySnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.backupKey#string + byte[] keyBackup = keyClient.backupKey("keyName"); + System.out.printf("Key's Backup Byte array's length %s", keyBackup.length); + // END: com.azure.keyvault.keys.keyclient.backupKey#string + } + + /** + * Generates a code sample for using {@link KeyClient#backupKeyWithResponse(String, Context)} + */ + public void backupKeyWithResponseSnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.backupKeyWithResponse#string-Context + byte[] keyBackup = keyClient.backupKeyWithResponse("keyName", new Context(key2, value2)).value(); + System.out.printf("Key's Backup Byte array's length %s", keyBackup.length); + // END: com.azure.keyvault.keys.keyclient.backupKeyWithResponse#string-Context + } + + /** + * Generates a code sample for using {@link KeyClient#restoreKey} + */ + public void restoreKeySnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.restoreKey#byte + byte[] keyBackupByteArray = {}; + Key keyResponse = keyClient.restoreKey(keyBackupByteArray); + System.out.printf("Restored Key with name %s and id %s \n", keyResponse.name(), keyResponse.id()); + // END: com.azure.keyvault.keys.keyclient.restoreKey#byte + } + + /** + * Generates a code sample for using {@link KeyClient#restoreKeyWithResponse(byte[], Context)} + */ + public void restoreKeyWithResponseSnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.restoreKeyWithResponse#byte-Context + byte[] keyBackupByteArray = {}; + Response keyResponse = keyClient.restoreKeyWithResponse(keyBackupByteArray, new Context(key1, value1)); + System.out.printf("Restored Key with name %s and id %s \n", + keyResponse.value().name(), keyResponse.value().id()); + // END: com.azure.keyvault.keys.keyclient.restoreKeyWithResponse#byte-Context + } + + /** + * Generates a code sample for using {@link KeyClient#listKeys} + */ + public void listKeySnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.listKeys + for (KeyBase key : keyClient.listKeys()) { + Key keyWithMaterial = keyClient.getKey(key); + System.out.printf("Received key with name %s and type %s", keyWithMaterial.name(), + keyWithMaterial.keyMaterial().kty()); + } + // END: com.azure.keyvault.keys.keyclient.listKeys + + // BEGIN: com.azure.keyvault.keys.keyclient.listKeys#Context + for (KeyBase key : keyClient.listKeys(new Context(key2, value2))) { + Key keyWithMaterial = keyClient.getKey(key); + System.out.printf("Received key with name %s and type %s", keyWithMaterial.name(), + keyWithMaterial.keyMaterial().kty()); + } + // END: com.azure.keyvault.keys.keyclient.listKeys#Context + } + + /** + * Generates a code sample for using {@link KeyClient#listDeletedKeys} + */ + public void listDeletedKeysSnippets() { + KeyClient keyClient = createClient(); + // BEGIN: com.azure.keyvault.keys.keyclient.listDeletedKeys + for (DeletedKey deletedKey : keyClient.listDeletedKeys()) { + System.out.printf("Deleted key's recovery Id %s", deletedKey.recoveryId()); + } + // END: com.azure.keyvault.keys.keyclient.listDeletedKeys + + // BEGIN: com.azure.keyvault.keys.keyclient.listDeletedKeys#Context + for (DeletedKey deletedKey : keyClient.listDeletedKeys(new Context(key2, value2))) { + System.out.printf("Deleted key's recovery Id %s", deletedKey.recoveryId()); + } + // END: com.azure.keyvault.keys.keyclient.listDeletedKeys#Context } /** @@ -101,11 +375,19 @@ public void listKeyVersions() { KeyClient keyClient = createClient(); // BEGIN: com.azure.keyvault.keys.keyclient.listKeyVersions for (KeyBase key : keyClient.listKeyVersions("keyName")) { - Key keyWithMaterial = keyClient.getKey(key).value(); + Key keyWithMaterial = keyClient.getKey(key); System.out.printf("Received key's version with name %s, type %s and version %s", keyWithMaterial.name(), keyWithMaterial.keyMaterial().kty(), keyWithMaterial.version()); } // END: com.azure.keyvault.keys.keyclient.listKeyVersions + + // BEGIN: com.azure.keyvault.keys.keyclient.listKeyVersions#Context + for (KeyBase key : keyClient.listKeyVersions("keyName", new Context(key2, value2))) { + Key keyWithMaterial = keyClient.getKey(key); + System.out.printf("Received key's version with name %s, type %s and version %s", keyWithMaterial.name(), + keyWithMaterial.keyMaterial().kty(), keyWithMaterial.version()); + } + // END: com.azure.keyvault.keys.keyclient.listKeyVersions#Context } /** diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperations.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperations.java index b719d6970856f..400fe84a2a054 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperations.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperations.java @@ -43,7 +43,7 @@ public static void main(String[] args) throws IllegalArgumentException { // You need to check te type of keys already exist in your key vault. Let's list the keys and print their types. // List operations don't return the keys with key material information. So, for each returned key we call getKey to get the key with its key material information. for (KeyBase key : keyClient.listKeys()) { - Key keyWithMaterial = keyClient.getKey(key).value(); + Key keyWithMaterial = keyClient.getKey(key); System.out.printf("Received key with name %s and type %s", keyWithMaterial.name(), keyWithMaterial.keyMaterial().kty()); } @@ -55,7 +55,7 @@ public static void main(String[] args) throws IllegalArgumentException { // You need to check all the different versions Cloud Rsa key had previously. Lets print all the versions of this key. for (KeyBase key : keyClient.listKeyVersions("CloudRsaKey")) { - Key keyWithMaterial = keyClient.getKey(key).value(); + Key keyWithMaterial = keyClient.getKey(key); System.out.printf("Received key's version with name %s, type %s and version %s", keyWithMaterial.name(), keyWithMaterial.keyMaterial().kty(), keyWithMaterial.version()); } } diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperationsAsync.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperationsAsync.java index f82d562845589..35ab9c7b1902f 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperationsAsync.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ListOperationsAsync.java @@ -35,11 +35,11 @@ public static void main(String[] args) throws InterruptedException { keyAsyncClient.createEcKey(new EcKeyCreateOptions("CloudEcKey") .expires(OffsetDateTime.now().plusYears(1))) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); Thread.sleep(2000); - keyAsyncClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") + keyAsyncClient.createRsaKeyWithResponse(new RsaKeyCreateOptions("CloudRsaKey") .expires(OffsetDateTime.now().plusYears(1))) .subscribe(keyResponse -> System.out.printf("Key is created with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); @@ -51,7 +51,7 @@ public static void main(String[] args) throws InterruptedException { keyAsyncClient.listKeys() .subscribe(keyBase -> keyAsyncClient.getKey(keyBase).subscribe(keyResponse -> - System.out.printf("Received key with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty()))); + System.out.printf("Received key with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty()))); Thread.sleep(15000); @@ -60,15 +60,15 @@ public static void main(String[] args) throws InterruptedException { keyAsyncClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") .keySize(4096) .expires(OffsetDateTime.now().plusYears(1))).subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); Thread.sleep(2000); // You need to check all the different versions Cloud Rsa key had previously. Lets print all the versions of this key. keyAsyncClient.listKeyVersions("CloudRsaKey").subscribe(keyBase -> keyAsyncClient.getKey(keyBase).subscribe(keyResponse -> - System.out.printf("Received key's version with name %s, type %s and version %s \n", keyResponse.value().name(), - keyResponse.value().keyMaterial().kty(), keyResponse.value().version()))); + System.out.printf("Received key's version with name %s, type %s and version %s \n", keyResponse.name(), + keyResponse.keyMaterial().kty(), keyResponse.version()))); Thread.sleep(15000); } diff --git a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeysAsync.java b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeysAsync.java index a9a206453ba8e..a88635df02911 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeysAsync.java +++ b/sdk/keyvault/azure-keyvault-keys/src/samples/java/com/azure/security/keyvault/keys/ManagingDeletedKeysAsync.java @@ -39,20 +39,20 @@ public static void main(String[] args) throws InterruptedException { keyAsyncClient.createEcKey(new EcKeyCreateOptions("CloudEcKey") .expires(OffsetDateTime.now().plusYears(1))) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); Thread.sleep(2000); keyAsyncClient.createRsaKey(new RsaKeyCreateOptions("CloudRsaKey") .expires(OffsetDateTime.now().plusYears(1))) .subscribe(keyResponse -> - System.out.printf("Key is created with name %s and type %s \n", keyResponse.value().name(), keyResponse.value().keyMaterial().kty())); + System.out.printf("Key is created with name %s and type %s \n", keyResponse.name(), keyResponse.keyMaterial().kty())); Thread.sleep(2000); // The Cloud Rsa Key is no longer needed, need to delete it from the key vault. keyAsyncClient.deleteKey("CloudEcKey").subscribe(deletedKeyResponse -> - System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.value().recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.recoveryId())); //To ensure key is deleted on server side. Thread.sleep(30000); @@ -60,17 +60,17 @@ public static void main(String[] args) throws InterruptedException { // We accidentally deleted Cloud Ec key. Let's recover it. // A deleted key can only be recovered if the key vault is soft-delete enabled. keyAsyncClient.recoverDeletedKey("CloudEcKey").subscribe(recoveredKeyResponse -> - System.out.printf("Recovered Key with name %s \n", recoveredKeyResponse.value().name())); + System.out.printf("Recovered Key with name %s \n", recoveredKeyResponse.name())); //To ensure key is recovered on server side. Thread.sleep(10000); // The Cloud Ec and Rsa keys are no longer needed, need to delete them from the key vault. keyAsyncClient.deleteKey("CloudEcKey").subscribe(deletedKeyResponse -> - System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.value().recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.recoveryId())); keyAsyncClient.deleteKey("CloudRsaKey").subscribe(deletedKeyResponse -> - System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.value().recoveryId())); + System.out.printf("Deleted Key's Recovery Id %s \n", deletedKeyResponse.recoveryId())); // To ensure key is deleted on server side. Thread.sleep(30000); diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyAsyncClientTest.java b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyAsyncClientTest.java index 4e21a1d56a9d4..c8b8acb7bb08c 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyAsyncClientTest.java +++ b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyAsyncClientTest.java @@ -14,10 +14,10 @@ import com.azure.security.keyvault.keys.models.KeyCreateOptions; import com.azure.security.keyvault.keys.models.webkey.KeyType; import io.netty.handler.codec.http.HttpResponseStatus; +import org.junit.Assert; import reactor.test.StepVerifier; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import static org.junit.Assert.assertEquals; @@ -34,20 +34,20 @@ protected void beforeTest() { if (interceptorManager.isPlaybackMode()) { client = clientSetup(credentials -> new KeyClientBuilder() - .credential(credentials) - .endpoint(getEndpoint()) - .httpClient(interceptorManager.getPlaybackClient()) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsyncClient()); + .credential(credentials) + .endpoint(getEndpoint()) + .httpClient(interceptorManager.getPlaybackClient()) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .buildAsyncClient()); } else { client = clientSetup(credentials -> new KeyClientBuilder() - .credential(credentials) - .endpoint(getEndpoint()) - .httpClient(HttpClient.createDefault().wiretap(true)) - .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .addPolicy(interceptorManager.getRecordPolicy()) - .addPolicy(new RetryPolicy()) - .buildAsyncClient()); + .credential(credentials) + .endpoint(getEndpoint()) + .httpClient(HttpClient.createDefault().wiretap(true)) + .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .addPolicy(interceptorManager.getRecordPolicy()) + .addPolicy(new RetryPolicy()) + .buildAsyncClient()); } } @@ -57,8 +57,8 @@ protected void beforeTest() { public void setKey() { setKeyRunner((expected) -> StepVerifier.create(client.createKey(expected)) - .assertNext(response -> assertKeyEquals(expected, response)) - .verifyComplete()); + .assertNext(response -> assertKeyEquals(expected, response)) + .verifyComplete()); } /** @@ -66,19 +66,17 @@ public void setKey() { */ public void setKeyEmptyName() { StepVerifier.create(client.createKey("", KeyType.RSA)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpResponseStatus.BAD_REQUEST.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, + HttpResponseStatus.BAD_REQUEST.code())); } /** * Tests that we can create keys when value is not null or an empty string. */ public void setKeyNullType() { - setKeyEmptyValueRunner((key) -> { - - StepVerifier.create(client.createKey(key)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpResponseStatus.BAD_REQUEST.code())); - - }); + setKeyEmptyValueRunner((key) -> StepVerifier.create(client.createKey(key)) + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, + HttpResponseStatus.BAD_REQUEST.code()))); } /** @@ -94,19 +92,19 @@ public void setKeyNull() { public void updateKey() { updateKeyRunner((original, updated) -> { StepVerifier.create(client.createKey(original)) - .assertNext(response -> assertKeyEquals(original, response)) - .verifyComplete(); - Key keyToUpdate = client.getKey(original.name()).block().value(); + .assertNext(response -> assertKeyEquals(original, response)) + .verifyComplete(); + Key keyToUpdate = client.getKey(original.name()).block(); StepVerifier.create(client.updateKey(keyToUpdate.expires(updated.expires()))) - .assertNext(response -> { - assertNotNull(response.value()); - assertEquals(original.name(), response.value().name()); - }).verifyComplete(); + .assertNext(response -> { + assertNotNull(response); + assertEquals(original.name(), response.name()); + }).verifyComplete(); StepVerifier.create(client.getKey(original.name())) - .assertNext(updatedKeyResponse -> assertKeyEquals(updated, updatedKeyResponse)) - .verifyComplete(); + .assertNext(updatedKeyResponse -> assertKeyEquals(updated, updatedKeyResponse)) + .verifyComplete(); }); } @@ -116,19 +114,19 @@ public void updateKey() { public void updateDisabledKey() { updateDisabledKeyRunner((original, updated) -> { StepVerifier.create(client.createKey(original)) - .assertNext(response -> assertKeyEquals(original, response)) - .verifyComplete(); - Key keyToUpdate = client.getKey(original.name()).block().value(); + .assertNext(response -> assertKeyEquals(original, response)) + .verifyComplete(); + Key keyToUpdate = client.getKey(original.name()).block(); StepVerifier.create(client.updateKey(keyToUpdate.expires(updated.expires()))) - .assertNext(response -> { - assertNotNull(response.value()); - assertEquals(original.name(), response.value().name()); - }).verifyComplete(); + .assertNext(response -> { + assertNotNull(response); + assertEquals(original.name(), response.name()); + }).verifyComplete(); StepVerifier.create(client.getKey(original.name())) - .assertNext(updatedKeyResponse -> assertKeyEquals(updated, updatedKeyResponse)) - .verifyComplete(); + .assertNext(updatedKeyResponse -> assertKeyEquals(updated, updatedKeyResponse)) + .verifyComplete(); }); } @@ -140,8 +138,8 @@ public void getKey() { getKeyRunner((original) -> { client.createKey(original); StepVerifier.create(client.getKey(original.name())) - .assertNext(response -> assertKeyEquals(original, response)) - .verifyComplete(); + .assertNext(response -> assertKeyEquals(original, response)) + .verifyComplete(); }); } @@ -150,16 +148,16 @@ public void getKey() { */ public void getKeySpecificVersion() { getKeySpecificVersionRunner((key, keyWithNewVal) -> { - final Key keyVersionOne = client.createKey(key).block().value(); - final Key keyVersionTwo = client.createKey(keyWithNewVal).block().value(); + final Key keyVersionOne = client.createKey(key).block(); + final Key keyVersionTwo = client.createKey(keyWithNewVal).block(); StepVerifier.create(client.getKey(key.name(), keyVersionOne.version())) - .assertNext(response -> assertKeyEquals(key, response)) - .verifyComplete(); + .assertNext(response -> assertKeyEquals(key, response)) + .verifyComplete(); StepVerifier.create(client.getKey(keyWithNewVal.name(), keyVersionTwo.version())) - .assertNext(response -> assertKeyEquals(keyWithNewVal, response)) - .verifyComplete(); + .assertNext(response -> assertKeyEquals(keyWithNewVal, response)) + .verifyComplete(); }); } @@ -168,7 +166,7 @@ public void getKeySpecificVersion() { */ public void getKeyNotFound() { StepVerifier.create(client.getKey("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); } @@ -178,31 +176,27 @@ public void getKeyNotFound() { public void deleteKey() { deleteKeyRunner((keyToDelete) -> { StepVerifier.create(client.createKey(keyToDelete)) - .assertNext(keyResponse -> { - assertKeyEquals(keyToDelete, keyResponse.value()); - }).verifyComplete(); + .assertNext(keyResponse -> assertKeyEquals(keyToDelete, keyResponse)).verifyComplete(); StepVerifier.create(client.deleteKey(keyToDelete.name())) - .assertNext(deletedKeyResponse -> { - DeletedKey deletedKey = deletedKeyResponse.value(); - assertNotNull(deletedKey.deletedDate()); - assertNotNull(deletedKey.recoveryId()); - assertNotNull(deletedKey.scheduledPurgeDate()); - assertEquals(keyToDelete.name(), deletedKey.name()); - }).verifyComplete(); + .assertNext(deletedKeyResponse -> { + assertNotNull(deletedKeyResponse.deletedDate()); + assertNotNull(deletedKeyResponse.recoveryId()); + assertNotNull(deletedKeyResponse.scheduledPurgeDate()); + assertEquals(keyToDelete.name(), deletedKeyResponse.name()); + }).verifyComplete(); sleepInRecordMode(30000); StepVerifier.create(client.purgeDeletedKey(keyToDelete.name())) - .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); - }).verifyComplete(); + .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), + voidResponse.statusCode())).verifyComplete(); sleepInRecordMode(15000); }); } public void deleteKeyNotFound() { StepVerifier.create(client.deleteKey("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); } /** @@ -210,7 +204,7 @@ public void deleteKeyNotFound() { */ public void getDeletedKeyNotFound() { StepVerifier.create(client.getDeletedKey("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); } /** @@ -219,24 +213,18 @@ public void getDeletedKeyNotFound() { public void recoverDeletedKey() { recoverDeletedKeyRunner((keyToDeleteAndRecover) -> { StepVerifier.create(client.createKey(keyToDeleteAndRecover)) - .assertNext(keyResponse -> { - assertKeyEquals(keyToDeleteAndRecover, keyResponse.value()); - }).verifyComplete(); + .assertNext(keyResponse -> assertKeyEquals(keyToDeleteAndRecover, keyResponse)).verifyComplete(); StepVerifier.create(client.deleteKey(keyToDeleteAndRecover.name())) - .assertNext(deletedKeyResponse -> { - DeletedKey deletedKey = deletedKeyResponse.value(); - assertNotNull(deletedKey); - }).verifyComplete(); + .assertNext(Assert::assertNotNull).verifyComplete(); sleepInRecordMode(30000); StepVerifier.create(client.recoverDeletedKey(keyToDeleteAndRecover.name())) - .assertNext(keyResponse -> { - Key recoveredKey = keyResponse.value(); - assertEquals(keyToDeleteAndRecover.name(), recoveredKey.name()); - assertEquals(keyToDeleteAndRecover.notBefore(), recoveredKey.notBefore()); - assertEquals(keyToDeleteAndRecover.expires(), recoveredKey.expires()); - }).verifyComplete(); + .assertNext(keyResponse -> { + assertEquals(keyToDeleteAndRecover.name(), keyResponse.name()); + assertEquals(keyToDeleteAndRecover.notBefore(), keyResponse.notBefore()); + assertEquals(keyToDeleteAndRecover.expires(), keyResponse.expires()); + }).verifyComplete(); }); } @@ -245,7 +233,7 @@ public void recoverDeletedKey() { */ public void recoverDeletedKeyNotFound() { StepVerifier.create(client.recoverDeletedKey("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); } /** @@ -254,16 +242,13 @@ public void recoverDeletedKeyNotFound() { public void backupKey() { backupKeyRunner((keyToBackup) -> { StepVerifier.create(client.createKey(keyToBackup)) - .assertNext(keyResponse -> { - assertKeyEquals(keyToBackup, keyResponse.value()); - }).verifyComplete(); + .assertNext(keyResponse -> assertKeyEquals(keyToBackup, keyResponse)).verifyComplete(); StepVerifier.create(client.backupKey(keyToBackup.name())) - .assertNext(response -> { - byte[] backupBytes = response.value(); - assertNotNull(backupBytes); - assertTrue(backupBytes.length > 0); - }).verifyComplete(); + .assertNext(response -> { + assertNotNull(response); + assertTrue(response.length > 0); + }).verifyComplete(); }); } @@ -272,7 +257,7 @@ public void backupKey() { */ public void backupKeyNotFound() { StepVerifier.create(client.backupKey("non-existing")) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceNotFoundException.class, HttpResponseStatus.NOT_FOUND.code())); } /** @@ -281,33 +266,26 @@ public void backupKeyNotFound() { public void restoreKey() { restoreKeyRunner((keyToBackupAndRestore) -> { StepVerifier.create(client.createKey(keyToBackupAndRestore)) - .assertNext(keyResponse -> { - assertKeyEquals(keyToBackupAndRestore, keyResponse.value()); - }).verifyComplete(); - byte[] backup = client.backupKey(keyToBackupAndRestore.name()).block().value(); + .assertNext(keyResponse -> assertKeyEquals(keyToBackupAndRestore, keyResponse)).verifyComplete(); + byte[] backup = client.backupKey(keyToBackupAndRestore.name()).block(); StepVerifier.create(client.deleteKey(keyToBackupAndRestore.name())) - .assertNext(deletedKeyResponse -> { - DeletedKey deletedKey = deletedKeyResponse.value(); - assertNotNull(deletedKey); - }).verifyComplete(); + .assertNext(Assert::assertNotNull).verifyComplete(); pollOnKeyDeletion(keyToBackupAndRestore.name()); StepVerifier.create(client.purgeDeletedKey(keyToBackupAndRestore.name())) - .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); - }).verifyComplete(); + .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), + voidResponse.statusCode())).verifyComplete(); pollOnKeyPurge(keyToBackupAndRestore.name()); sleepInRecordMode(60000); StepVerifier.create(client.restoreKey(backup)) - .assertNext(response -> { - Key restoredKey = response.value(); - assertEquals(keyToBackupAndRestore.name(), restoredKey.name()); - assertEquals(keyToBackupAndRestore.notBefore(), restoredKey.notBefore()); - assertEquals(keyToBackupAndRestore.expires(), restoredKey.expires()); - }).verifyComplete(); + .assertNext(response -> { + assertEquals(keyToBackupAndRestore.name(), response.name()); + assertEquals(keyToBackupAndRestore.notBefore(), response.notBefore()); + assertEquals(keyToBackupAndRestore.expires(), response.expires()); + }).verifyComplete(); }); } @@ -317,7 +295,7 @@ public void restoreKey() { public void restoreKeyFromMalformedBackup() { byte[] keyBackupBytes = "non-existing".getBytes(); StepVerifier.create(client.restoreKey(keyBackupBytes)) - .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpResponseStatus.BAD_REQUEST.code())); + .verifyErrorSatisfies(ex -> assertRestException(ex, ResourceModifiedException.class, HttpResponseStatus.BAD_REQUEST.code())); } /** @@ -327,31 +305,24 @@ public void getDeletedKey() { getDeletedKeyRunner((keyToDeleteAndGet) -> { StepVerifier.create(client.createKey(keyToDeleteAndGet)) - .assertNext(keyResponse -> { - assertKeyEquals(keyToDeleteAndGet, keyResponse.value()); - }).verifyComplete(); + .assertNext(keyResponse -> assertKeyEquals(keyToDeleteAndGet, keyResponse)).verifyComplete(); StepVerifier.create(client.deleteKey(keyToDeleteAndGet.name())) - .assertNext(deletedKeyResponse -> { - DeletedKey deletedKey = deletedKeyResponse.value(); - assertNotNull(deletedKey); - }).verifyComplete(); + .assertNext(Assert::assertNotNull).verifyComplete(); pollOnKeyDeletion(keyToDeleteAndGet.name()); sleepInRecordMode(30000); StepVerifier.create(client.getDeletedKey(keyToDeleteAndGet.name())) - .assertNext(deletedKeyResponse -> { - DeletedKey deletedKey = deletedKeyResponse.value(); - assertNotNull(deletedKey.deletedDate()); - assertNotNull(deletedKey.recoveryId()); - assertNotNull(deletedKey.scheduledPurgeDate()); - assertEquals(keyToDeleteAndGet.name(), deletedKey.name()); - }).verifyComplete(); + .assertNext(deletedKeyResponse -> { + assertNotNull(deletedKeyResponse.deletedDate()); + assertNotNull(deletedKeyResponse.recoveryId()); + assertNotNull(deletedKeyResponse.scheduledPurgeDate()); + assertEquals(keyToDeleteAndGet.name(), deletedKeyResponse.name()); + }).verifyComplete(); StepVerifier.create(client.purgeDeletedKey(keyToDeleteAndGet.name())) - .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); - }).verifyComplete(); + .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), + voidResponse.statusCode())).verifyComplete(); pollOnKeyPurge(keyToDeleteAndGet.name()); sleepInRecordMode(15000); }); @@ -364,22 +335,16 @@ public void getDeletedKey() { public void listDeletedKeys() { listDeletedKeysRunner((keys) -> { - HashMap keysToDelete = keys; List deletedKeys = new ArrayList<>(); - for (KeyCreateOptions key : keysToDelete.values()) { + for (KeyCreateOptions key : keys.values()) { StepVerifier.create(client.createKey(key)) - .assertNext(keyResponse -> { - assertKeyEquals(key, keyResponse.value()); - }).verifyComplete(); + .assertNext(keyResponse -> assertKeyEquals(key, keyResponse)).verifyComplete(); } sleepInRecordMode(10000); - for (KeyCreateOptions key : keysToDelete.values()) { + for (KeyCreateOptions key : keys.values()) { StepVerifier.create(client.deleteKey(key.name())) - .assertNext(deletedKeyResponse -> { - DeletedKey deletedKey = deletedKeyResponse.value(); - assertNotNull(deletedKey); - }).verifyComplete(); + .assertNext(Assert::assertNotNull).verifyComplete(); pollOnKeyDeletion(key.name()); } @@ -388,20 +353,19 @@ public void listDeletedKeys() { sleepInRecordMode(30000); for (DeletedKey actualKey : deletedKeys) { - if (keysToDelete.containsKey(actualKey.name())) { + if (keys.containsKey(actualKey.name())) { assertNotNull(actualKey.deletedDate()); assertNotNull(actualKey.recoveryId()); - keysToDelete.remove(actualKey.name()); + keys.remove(actualKey.name()); } } - assertEquals(0, keysToDelete.size()); + assertEquals(0, keys.size()); for (DeletedKey deletedKey : deletedKeys) { StepVerifier.create(client.purgeDeletedKey(deletedKey.name())) - .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); - }).verifyComplete(); + .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), + voidResponse.statusCode())).verifyComplete(); pollOnKeyPurge(deletedKey.name()); } }); @@ -413,32 +377,27 @@ public void listDeletedKeys() { @Override public void listKeyVersions() { listKeyVersionsRunner((keys) -> { - List keyVersions = keys; List output = new ArrayList<>(); String keyName = null; - for (KeyCreateOptions key : keyVersions) { + for (KeyCreateOptions key : keys) { keyName = key.name(); - client.createKey(key).subscribe(keyResponse -> assertKeyEquals(key, keyResponse.value())); + client.createKey(key).subscribe(keyResponse -> assertKeyEquals(key, keyResponse)); sleepInRecordMode(1000); } sleepInRecordMode(30000); client.listKeyVersions(keyName).subscribe(output::add); sleepInRecordMode(30000); - assertEquals(keyVersions.size(), output.size()); + assertEquals(keys.size(), output.size()); StepVerifier.create(client.deleteKey(keyName)) - .assertNext(deletedKeyResponse -> { - DeletedKey deletedKey = deletedKeyResponse.value(); - assertNotNull(deletedKey); - }).verifyComplete(); + .assertNext(Assert::assertNotNull).verifyComplete(); pollOnKeyDeletion(keyName); StepVerifier.create(client.purgeDeletedKey(keyName)) - .assertNext(voidResponse -> { - assertEquals(HttpResponseStatus.NO_CONTENT.code(), voidResponse.statusCode()); - }).verifyComplete(); + .assertNext(voidResponse -> assertEquals(HttpResponseStatus.NO_CONTENT.code(), + voidResponse.statusCode())).verifyComplete(); pollOnKeyPurge(keyName); }); @@ -449,10 +408,9 @@ public void listKeyVersions() { */ public void listKeys() { listKeysRunner((keys) -> { - HashMap keysToList = keys; List output = new ArrayList<>(); - for (KeyCreateOptions key : keysToList.values()) { - client.createKey(key).subscribe(keyResponse -> assertKeyEquals(key, keyResponse.value())); + for (KeyCreateOptions key : keys.values()) { + client.createKey(key).subscribe(keyResponse -> assertKeyEquals(key, keyResponse)); sleepInRecordMode(1000); } sleepInRecordMode(30000); @@ -471,43 +429,40 @@ public void listKeys() { }); } - private DeletedKey pollOnKeyDeletion(String keyName) { + private void pollOnKeyDeletion(String keyName) { int pendingPollCount = 0; while (pendingPollCount < 30) { DeletedKey deletedKey = null; try { - deletedKey = client.getDeletedKey(keyName).block().value(); + deletedKey = client.getDeletedKeyWithResponse(keyName).block().value(); } catch (ResourceNotFoundException e) { } if (deletedKey == null) { sleepInRecordMode(2000); pendingPollCount += 1; - continue; } else { - return deletedKey; + return; } } System.err.printf("Deleted Key %s not found \n", keyName); - return null; } - private DeletedKey pollOnKeyPurge(String keyName) { + private void pollOnKeyPurge(String keyName) { int pendingPollCount = 0; while (pendingPollCount < 10) { DeletedKey deletedKey = null; try { - deletedKey = client.getDeletedKey(keyName).block().value(); + deletedKey = client.getDeletedKeyWithResponse(keyName).block().value(); } catch (ResourceNotFoundException e) { } if (deletedKey != null) { sleepInRecordMode(2000); pendingPollCount += 1; - continue; } else { - return deletedKey; + return; } } System.err.printf("Deleted Key %s was not purged \n", keyName); - return null; } } + diff --git a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java index a07fa17a52de8..bb1a6858fdc82 100644 --- a/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java +++ b/sdk/keyvault/azure-keyvault-keys/src/test/java/com/azure/security/keyvault/keys/KeyClientTest.java @@ -86,7 +86,7 @@ public void setKeyNull() { public void updateKey() { updateKeyRunner((original, updated) -> { assertKeyEquals(original, client.createKey(original)); - Key keyToUpdate = client.getKey(original.name()).value(); + Key keyToUpdate = client.getKey(original.name()); client.updateKey(keyToUpdate.expires(updated.expires())); assertKeyEquals(updated, client.getKey(original.name())); }); @@ -98,7 +98,7 @@ public void updateKey() { public void updateDisabledKey() { updateDisabledKeyRunner((original, updated) -> { assertKeyEquals(original, client.createKey(original)); - Key keyToUpdate = client.getKey(original.name()).value(); + Key keyToUpdate = client.getKey(original.name()); client.updateKey(keyToUpdate.expires(updated.expires())); assertKeyEquals(updated, client.getKey(original.name())); }); @@ -119,8 +119,8 @@ public void getKey() { */ public void getKeySpecificVersion() { getKeySpecificVersionRunner((key, keyWithNewVal) -> { - Key keyVersionOne = client.createKey(key).value(); - Key keyVersionTwo = client.createKey(keyWithNewVal).value(); + Key keyVersionOne = client.createKey(key); + Key keyVersionTwo = client.createKey(keyWithNewVal); assertKeyEquals(key, client.getKey(keyVersionOne.name(), keyVersionOne.version())); assertKeyEquals(keyWithNewVal, client.getKey(keyVersionTwo.name(), keyVersionTwo.version())); }); @@ -139,7 +139,7 @@ public void getKeyNotFound() { public void deleteKey() { deleteKeyRunner((keyToDelete) -> { assertKeyEquals(keyToDelete, client.createKey(keyToDelete)); - DeletedKey deletedKey = client.deleteKey(keyToDelete.name()).value(); + DeletedKey deletedKey = client.deleteKey(keyToDelete.name()); pollOnKeyDeletion(keyToDelete.name()); assertNotNull(deletedKey.deletedDate()); assertNotNull(deletedKey.recoveryId()); @@ -169,9 +169,9 @@ public void getDeletedKeyNotFound() { public void recoverDeletedKey() { recoverDeletedKeyRunner((keyToDeleteAndRecover) -> { assertKeyEquals(keyToDeleteAndRecover, client.createKey(keyToDeleteAndRecover)); - assertNotNull(client.deleteKey(keyToDeleteAndRecover.name()).value()); + assertNotNull(client.deleteKey(keyToDeleteAndRecover.name())); pollOnKeyDeletion(keyToDeleteAndRecover.name()); - Key recoveredKey = client.recoverDeletedKey(keyToDeleteAndRecover.name()).value(); + Key recoveredKey = client.recoverDeletedKey(keyToDeleteAndRecover.name()); assertEquals(keyToDeleteAndRecover.name(), recoveredKey.name()); assertEquals(keyToDeleteAndRecover.notBefore(), recoveredKey.notBefore()); assertEquals(keyToDeleteAndRecover.expires(), recoveredKey.expires()); @@ -191,7 +191,7 @@ public void recoverDeletedKeyNotFound() { public void backupKey() { backupKeyRunner((keyToBackup) -> { assertKeyEquals(keyToBackup, client.createKey(keyToBackup)); - byte[] backupBytes = (client.backupKey(keyToBackup.name()).value()); + byte[] backupBytes = (client.backupKey(keyToBackup.name())); assertNotNull(backupBytes); assertTrue(backupBytes.length > 0); }); @@ -210,7 +210,7 @@ public void backupKeyNotFound() { public void restoreKey() { restoreKeyRunner((keyToBackupAndRestore) -> { assertKeyEquals(keyToBackupAndRestore, client.createKey(keyToBackupAndRestore)); - byte[] backupBytes = (client.backupKey(keyToBackupAndRestore.name()).value()); + byte[] backupBytes = (client.backupKey(keyToBackupAndRestore.name())); assertNotNull(backupBytes); assertTrue(backupBytes.length > 0); client.deleteKey(keyToBackupAndRestore.name()); @@ -218,7 +218,7 @@ public void restoreKey() { client.purgeDeletedKey(keyToBackupAndRestore.name()); pollOnKeyPurge(keyToBackupAndRestore.name()); sleepInRecordMode(60000); - Key restoredKey = client.restoreKey(backupBytes).value(); + Key restoredKey = client.restoreKey(backupBytes); assertEquals(keyToBackupAndRestore.name(), restoredKey.name()); assertEquals(keyToBackupAndRestore.expires(), restoredKey.expires()); }); @@ -261,10 +261,10 @@ public void listKeys() { public void getDeletedKey() { getDeletedKeyRunner((keyToDeleteAndGet) -> { assertKeyEquals(keyToDeleteAndGet, client.createKey(keyToDeleteAndGet)); - assertNotNull(client.deleteKey(keyToDeleteAndGet.name()).value()); + assertNotNull(client.deleteKey(keyToDeleteAndGet.name())); pollOnKeyDeletion(keyToDeleteAndGet.name()); sleepInRecordMode(30000); - DeletedKey deletedKey = client.getDeletedKey(keyToDeleteAndGet.name()).value(); + DeletedKey deletedKey = client.getDeletedKey(keyToDeleteAndGet.name()); assertNotNull(deletedKey.deletedDate()); assertNotNull(deletedKey.recoveryId()); assertNotNull(deletedKey.scheduledPurgeDate()); @@ -343,7 +343,7 @@ private DeletedKey pollOnKeyDeletion(String keyName) { while (pendingPollCount < 30) { DeletedKey deletedKey = null; try { - deletedKey = client.getDeletedKey(keyName).value(); + deletedKey = client.getDeletedKey(keyName); } catch (ResourceNotFoundException e) { } if (deletedKey == null) { @@ -363,7 +363,7 @@ private DeletedKey pollOnKeyPurge(String keyName) { while (pendingPollCount < 10) { DeletedKey deletedKey = null; try { - deletedKey = client.getDeletedKey(keyName).value(); + deletedKey = client.getDeletedKey(keyName); } catch (ResourceNotFoundException e) { } if (deletedKey != null) { diff --git a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClientBuilder.java b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClientBuilder.java index 5d51121fb007c..2cbd05b7b2607 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClientBuilder.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/main/java/com/azure/security/keyvault/secrets/SecretClientBuilder.java @@ -3,6 +3,7 @@ package com.azure.security.keyvault.secrets; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.implementation.annotation.ServiceClientBuilder; import com.azure.core.util.configuration.ConfigurationManager; import com.azure.core.util.configuration.Configuration; @@ -126,7 +127,7 @@ public SecretAsyncClient buildAsyncClient() { policies.addAll(this.policies); policies.add(new HttpLoggingPolicy(httpLogDetailLevel)); - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); diff --git a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretClientJavaDocCodeSnippets.java b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretClientJavaDocCodeSnippets.java index 3b71f4e882ccc..7b92e5986b42e 100644 --- a/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretClientJavaDocCodeSnippets.java +++ b/sdk/keyvault/azure-keyvault-secrets/src/samples/java/com/azure/security/keyvault/secrets/SecretClientJavaDocCodeSnippets.java @@ -5,6 +5,7 @@ import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.core.test.models.RecordedData; import com.azure.core.test.policy.RecordNetworkCallPolicy; @@ -24,7 +25,7 @@ public final class SecretClientJavaDocCodeSnippets { public SecretAsyncClient createAsyncClientWithHttpclient() { // BEGIN: com.azure.security.keyvault.keys.async.secretclient.withhttpclient.instantiation RecordedData networkData = new RecordedData(); - HttpPipeline pipeline = HttpPipeline.builder().policies(new RecordNetworkCallPolicy(networkData)).build(); + HttpPipeline pipeline = new HttpPipelineBuilder().policies(new RecordNetworkCallPolicy(networkData)).build(); SecretAsyncClient keyClient = new SecretClientBuilder() .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .endpoint("https://myvault.azure.net/") @@ -89,7 +90,7 @@ private SecretClient getSyncSecretClient() { public SecretAsyncClient createAsyncClientWithPipeline() { // BEGIN: com.azure.security.keyvault.keys.async.secretclient.pipeline.instantiation RecordedData networkData = new RecordedData(); - HttpPipeline pipeline = HttpPipeline.builder().policies(new RecordNetworkCallPolicy(networkData)).build(); + HttpPipeline pipeline = new HttpPipelineBuilder().policies(new RecordNetworkCallPolicy(networkData)).build(); SecretAsyncClient keyClient = new SecretClientBuilder() .pipeline(pipeline) .endpoint("https://myvault.azure.net/") diff --git a/storage/client/blob/pom.xml b/storage/client/blob/pom.xml index b661ff0ad7e2d..00132d720cd8c 100644 --- a/storage/client/blob/pom.xml +++ b/storage/client/blob/pom.xml @@ -49,7 +49,7 @@ com.azure azure-core - 1.0.0-preview.2 + 1.0.0-preview.3 org.slf4j @@ -69,7 +69,7 @@ com.azure azure-core-test - 1.0.0-preview.2 + 1.0.0-preview.3 test diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java index c8ceb3f311d3f..1e5f741d3b8a6 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobAsyncClient.java @@ -98,7 +98,7 @@ public class BlobAsyncClient { public BlockBlobAsyncClient asBlockBlobAsyncClient() { return new BlockBlobAsyncClient(new AzureBlobStorageBuilder() .url(getBlobUrl().toString()) - .pipeline(azureBlobStorage.httpPipeline()), snapshot); + .pipeline(azureBlobStorage.getHttpPipeline()), snapshot); } /** @@ -110,7 +110,7 @@ public BlockBlobAsyncClient asBlockBlobAsyncClient() { public AppendBlobAsyncClient asAppendBlobAsyncClient() { return new AppendBlobAsyncClient(new AzureBlobStorageBuilder() .url(getBlobUrl().toString()) - .pipeline(azureBlobStorage.httpPipeline()), snapshot); + .pipeline(azureBlobStorage.getHttpPipeline()), snapshot); } /** @@ -122,7 +122,7 @@ public AppendBlobAsyncClient asAppendBlobAsyncClient() { public PageBlobAsyncClient asPageBlobAsyncClient() { return new PageBlobAsyncClient(new AzureBlobStorageBuilder() .url(getBlobUrl().toString()) - .pipeline(azureBlobStorage.httpPipeline()), snapshot); + .pipeline(azureBlobStorage.getHttpPipeline()), snapshot); } /** @@ -136,7 +136,7 @@ public ContainerAsyncClient getContainerAsyncClient() { BlobURLParts parts = URLParser.parse(getBlobUrl()); return new ContainerAsyncClient(new AzureBlobStorageBuilder() .url(String.format("%s://%s/%s", parts.scheme(), parts.host(), parts.containerName())) - .pipeline(azureBlobStorage.httpPipeline())); + .pipeline(azureBlobStorage.getHttpPipeline())); } /** @@ -147,13 +147,13 @@ public ContainerAsyncClient getContainerAsyncClient() { */ public URL getBlobUrl() { try { - UrlBuilder urlBuilder = UrlBuilder.parse(azureBlobStorage.url()); + UrlBuilder urlBuilder = UrlBuilder.parse(azureBlobStorage.getUrl()); if (snapshot != null) { urlBuilder.query("snapshot=" + snapshot); } return urlBuilder.toURL(); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.url()), e); + throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e); } } @@ -925,7 +925,7 @@ public String generateSAS(String identifier, BlobSASPermission permissions, Offs cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); SharedKeyCredential sharedKeyCredential = - Utility.getSharedKeyCredential(this.azureBlobStorage.httpPipeline()); + Utility.getSharedKeyCredential(this.azureBlobStorage.getHttpPipeline()); Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential); @@ -944,7 +944,7 @@ ServiceSASSignatureValues configureServiceSASSignatureValues(ServiceSASSignature String accountName) { // Set canonical name - serviceSASSignatureValues.canonicalName(this.azureBlobStorage.url(), accountName); + serviceSASSignatureValues.canonicalName(this.azureBlobStorage.getUrl(), accountName); // Set snapshotId serviceSASSignatureValues.snapshotId(getSnapshotId()); diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java index b0e3c98d8904a..4467ea5f6a01a 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/BlobClientBuilder.java @@ -6,6 +6,7 @@ import com.azure.core.credentials.TokenCredential; import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.policy.AddDatePolicy; import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogDetailLevel; @@ -120,7 +121,7 @@ private AzureBlobStorageBuilder buildImpl() { policies.addAll(this.policies); policies.add(new HttpLoggingPolicy(logLevel)); - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java index 936bab6932528..f9cf29c3e79f0 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java @@ -107,7 +107,7 @@ public BlockBlobAsyncClient getBlockBlobAsyncClient(String blobName) { public BlockBlobAsyncClient getBlockBlobAsyncClient(String blobName, String snapshot) { return new BlockBlobAsyncClient(new AzureBlobStorageBuilder() .url(Utility.appendToURLPath(getContainerUrl(), blobName).toString()) - .pipeline(azureBlobStorage.httpPipeline()), snapshot); + .pipeline(azureBlobStorage.getHttpPipeline()), snapshot); } /** @@ -140,7 +140,7 @@ public PageBlobAsyncClient getPageBlobAsyncClient(String blobName) { public PageBlobAsyncClient getPageBlobAsyncClient(String blobName, String snapshot) { return new PageBlobAsyncClient(new AzureBlobStorageBuilder() .url(Utility.appendToURLPath(getContainerUrl(), blobName).toString()) - .pipeline(azureBlobStorage.httpPipeline()), snapshot); + .pipeline(azureBlobStorage.getHttpPipeline()), snapshot); } /** @@ -173,7 +173,7 @@ public AppendBlobAsyncClient getAppendBlobAsyncClient(String blobName) { public AppendBlobAsyncClient getAppendBlobAsyncClient(String blobName, String snapshot) { return new AppendBlobAsyncClient(new AzureBlobStorageBuilder() .url(Utility.appendToURLPath(getContainerUrl(), blobName).toString()) - .pipeline(azureBlobStorage.httpPipeline()), snapshot); + .pipeline(azureBlobStorage.getHttpPipeline()), snapshot); } /** @@ -202,7 +202,7 @@ public BlobAsyncClient getBlobAsyncClient(String blobName) { public BlobAsyncClient getBlobAsyncClient(String blobName, String snapshot) { return new BlobAsyncClient(new AzureBlobStorageBuilder() .url(Utility.appendToURLPath(getContainerUrl(), blobName).toString()) - .pipeline(azureBlobStorage.httpPipeline()), snapshot); + .pipeline(azureBlobStorage.getHttpPipeline()), snapshot); } /** @@ -213,7 +213,7 @@ public BlobAsyncClient getBlobAsyncClient(String blobName, String snapshot) { public StorageAsyncClient getStorageAsyncClient() { return new StorageAsyncClient(new AzureBlobStorageBuilder() .url(Utility.stripLastPathSegment(getContainerUrl()).toString()) - .pipeline(azureBlobStorage.httpPipeline())); + .pipeline(azureBlobStorage.getHttpPipeline())); } /** @@ -224,9 +224,9 @@ public StorageAsyncClient getStorageAsyncClient() { */ public URL getContainerUrl() { try { - return new URL(azureBlobStorage.url()); + return new URL(azureBlobStorage.getUrl()); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.url()), e); + throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e); } } @@ -681,7 +681,7 @@ private Flux listBlobsHierarchyHelper(String delimiter, ListBlobsOptio } else { prefixes = Flux.empty(); } - Flux result = blobs.concatWith(prefixes.map(prefix -> new BlobItem().name(prefix.name()).isPrefix(true))); + Flux result = blobs.map(item -> item.isPrefix(false)).concatWith(prefixes.map(prefix -> new BlobItem().name(prefix.name()).isPrefix(true))); if (response.value().nextMarker() != null) { // Recursively add the continuation items to the observable. @@ -1102,7 +1102,7 @@ public String generateSAS(String identifier, ContainerSASPermission permissions, cacheControl, contentDisposition, contentEncoding, contentLanguage, contentType); SharedKeyCredential sharedKeyCredential = - Utility.getSharedKeyCredential(this.azureBlobStorage.httpPipeline()); + Utility.getSharedKeyCredential(this.azureBlobStorage.getHttpPipeline()); Utility.assertNotNull("sharedKeyCredential", sharedKeyCredential); @@ -1119,7 +1119,7 @@ public String generateSAS(String identifier, ContainerSASPermission permissions, */ private ServiceSASSignatureValues configureServiceSASSignatureValues(ServiceSASSignatureValues serviceSASSignatureValues, String accountName) { // Set canonical name - serviceSASSignatureValues.canonicalName(this.azureBlobStorage.url(), accountName); + serviceSASSignatureValues.canonicalName(this.azureBlobStorage.getUrl(), accountName); // Set snapshotId to null serviceSASSignatureValues.snapshotId(null); diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java b/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java index 7c9e9543ffd94..97a05be2ed254 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java @@ -6,6 +6,7 @@ import com.azure.core.credentials.TokenCredential; import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.policy.AddDatePolicy; import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogDetailLevel; @@ -110,7 +111,7 @@ private AzureBlobStorageBuilder buildImpl() { policies.addAll(this.policies); policies.add(new HttpLoggingPolicy(logLevel)); - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageAsyncClient.java b/storage/client/blob/src/main/java/com/azure/storage/blob/StorageAsyncClient.java index 9e4d0fb2140f5..e84d23ee1dbe0 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageAsyncClient.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/StorageAsyncClient.java @@ -73,7 +73,7 @@ public final class StorageAsyncClient { public ContainerAsyncClient getContainerAsyncClient(String containerName) { return new ContainerAsyncClient(new AzureBlobStorageBuilder() .url(Utility.appendToURLPath(getAccountUrl(), containerName).toString()) - .pipeline(azureBlobStorage.httpPipeline())); + .pipeline(azureBlobStorage.getHttpPipeline())); } /** @@ -125,9 +125,9 @@ public Mono deleteContainer(String containerName) { */ public URL getAccountUrl() { try { - return new URL(azureBlobStorage.url()); + return new URL(azureBlobStorage.getUrl()); } catch (MalformedURLException e) { - throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.url()), e); + throw new RuntimeException(String.format("Invalid URL on %s: %s" + getClass().getSimpleName(), azureBlobStorage.getUrl()), e); } } @@ -318,7 +318,7 @@ public String generateAccountSAS(AccountSASService accountSASService, AccountSAS accountSASSignatureValues.ipRange(ipRange); accountSASSignatureValues.protocol(sasProtocol); - SharedKeyCredential sharedKeyCredential = Utility.getSharedKeyCredential(this.azureBlobStorage.httpPipeline()); + SharedKeyCredential sharedKeyCredential = Utility.getSharedKeyCredential(this.azureBlobStorage.getHttpPipeline()); SASQueryParameters sasQueryParameters = accountSASSignatureValues.generateSASQueryParameters(sharedKeyCredential); diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageClientBuilder.java b/storage/client/blob/src/main/java/com/azure/storage/blob/StorageClientBuilder.java index fbbdc0f438ac0..a73249dec8f70 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/StorageClientBuilder.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/StorageClientBuilder.java @@ -6,6 +6,7 @@ import com.azure.core.credentials.TokenCredential; import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.policy.AddDatePolicy; import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogDetailLevel; @@ -104,7 +105,7 @@ private AzureBlobStorageBuilder buildImpl() { policies.addAll(this.policies); policies.add(new HttpLoggingPolicy(logLevel)); - HttpPipeline pipeline = HttpPipeline.builder() + HttpPipeline pipeline = new HttpPipelineBuilder() .policies(policies.toArray(new HttpPipelinePolicy[0])) .httpClient(httpClient) .build(); diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java index a6f486ff075f7..3439bb917017e 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java @@ -4,18 +4,20 @@ package com.azure.storage.blob.implementation; -import com.azure.core.annotations.BodyParam; -import com.azure.core.annotations.ExpectedResponses; -import com.azure.core.annotations.HeaderParam; -import com.azure.core.annotations.Host; -import com.azure.core.annotations.HostParam; -import com.azure.core.annotations.PUT; -import com.azure.core.annotations.PathParam; -import com.azure.core.annotations.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; 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.ExpectedResponses; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.PathParam; +import com.azure.core.implementation.annotation.Put; +import com.azure.core.implementation.annotation.QueryParam; +import com.azure.core.implementation.annotation.ReturnType; +import com.azure.core.implementation.annotation.ServiceInterface; +import com.azure.core.implementation.annotation.ServiceMethod; +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.AppendBlobsAppendBlockFromUrlResponse; @@ -56,28 +58,28 @@ public final class AppendBlobsImpl { * @param client the instance of the service client containing this operation class. */ public AppendBlobsImpl(AzureBlobStorageImpl client) { - this.service = RestProxy.create(AppendBlobsService.class, client); + this.service = RestProxy.create(AppendBlobsService.class, client.getHttpPipeline()); this.client = client; } /** - * The interface defining all the services for AppendBlobs to be used by - * the proxy service to perform REST calls. + * The interface defining all the services for AzureBlobStorageAppendBlobs + * to be used by the proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Blobs AppendBlob") + @ServiceInterface(name = "AzureBlobStorageAppendBlobs") private interface AppendBlobsService { - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @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); @@ -93,6 +95,7 @@ private interface AppendBlobsService { * @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, Context context) { final Integer timeout = null; final Map metadata = null; @@ -112,7 +115,7 @@ public Mono createWithRestResponseAsync(String contai String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.create(containerName, blob, this.client.url(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), 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, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -134,6 +137,7 @@ public Mono createWithRestResponseAsync(String contai * @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) { final String blobType = "AppendBlob"; String blobContentType = null; @@ -183,7 +187,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.url(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), 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, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -197,6 +201,7 @@ public Mono createWithRestResponseAsync(String contai * @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, Context context) { final Integer timeout = null; final String encryptionKey = null; @@ -212,7 +217,7 @@ public Mono appendBlockWithRestResponseAsync(Str String transactionalContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.appendBlock(containerName, blob, this.client.url(), body, timeout, contentLength, transactionalContentMD5Converted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + 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); } /** @@ -235,6 +240,7 @@ public Mono appendBlockWithRestResponseAsync(Str * @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) { final String comp = "appendblock"; String leaseId = null; @@ -268,7 +274,7 @@ public Mono appendBlockWithRestResponseAsync(Str String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.appendBlock(containerName, blob, this.client.url(), body, timeout, contentLength, transactionalContentMD5Converted, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + 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); } /** @@ -282,6 +288,7 @@ public Mono appendBlockWithRestResponseAsync(Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @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, Context context) { final String sourceRange = null; final Integer timeout = null; @@ -299,7 +306,7 @@ public Mono appendBlockFromUrlWithRestRes DateTimeRfc1123 ifUnmodifiedSinceConverted = null; DateTimeRfc1123 sourceIfModifiedSinceConverted = null; DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; - return service.appendBlockFromUrl(containerName, blob, this.client.url(), sourceUrl, sourceRange, sourceContentMD5Converted, timeout, contentLength, this.client.version(), 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, timeout, contentLength, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -321,6 +328,7 @@ public Mono appendBlockFromUrlWithRestRes * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { final String comp = "appendblock"; String leaseId = null; @@ -372,6 +380,6 @@ public Mono appendBlockFromUrlWithRestRes 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.url(), sourceUrl, sourceRange, sourceContentMD5Converted, timeout, contentLength, this.client.version(), 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, timeout, contentLength, this.client.getVersion(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java index c77d984c4e928..95eccfcca197c 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java @@ -6,10 +6,12 @@ import com.azure.core.http.HttpPipeline; import com.azure.core.implementation.RestProxy; +import com.azure.core.implementation.annotation.ServiceClientBuilder; /** * A builder for creating a new instance of the AzureBlobStorage type. */ +@ServiceClientBuilder(serviceClients = AzureBlobStorageImpl.class) public final class AzureBlobStorageBuilder { /* * The URL of the service account, container, or blob that is the targe of the desired operation. @@ -73,10 +75,10 @@ public AzureBlobStorageImpl build() { } AzureBlobStorageImpl client = new AzureBlobStorageImpl(pipeline); if (this.url != null) { - client.url(this.url); + client.setUrl(this.url); } if (this.version != null) { - client.version(this.version); + client.setVersion(this.version); } return client; } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java index 6702b82da14ea..6df6ced959bcd 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java @@ -4,14 +4,13 @@ package com.azure.storage.blob.implementation; -import com.azure.core.ServiceClient; import com.azure.core.http.HttpPipeline; import com.azure.core.implementation.RestProxy; /** * Initializes a new instance of the AzureBlobStorage type. */ -public final class AzureBlobStorageImpl extends ServiceClient { +public final class AzureBlobStorageImpl { /** * The URL of the service account, container, or blob that is the targe of the desired operation. */ @@ -22,7 +21,7 @@ public final class AzureBlobStorageImpl extends ServiceClient { * * @return the url value. */ - public String url() { + public String getUrl() { return this.url; } @@ -32,7 +31,7 @@ public String url() { * @param url the url value. * @return the service client itself. */ - AzureBlobStorageImpl url(String url) { + AzureBlobStorageImpl setUrl(String url) { this.url = url; return this; } @@ -47,7 +46,7 @@ AzureBlobStorageImpl url(String url) { * * @return the version value. */ - public String version() { + public String getVersion() { return this.version; } @@ -57,11 +56,25 @@ public String version() { * @param version the version value. * @return the service client itself. */ - AzureBlobStorageImpl version(String version) { + AzureBlobStorageImpl setVersion(String version) { this.version = version; return this; } + /** + * The HTTP pipeline to send requests through. + */ + private HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + /** * The ServicesImpl object to access its operations. */ @@ -159,7 +172,7 @@ public AzureBlobStorageImpl() { * @param httpPipeline The HTTP pipeline to send requests through. */ public AzureBlobStorageImpl(HttpPipeline httpPipeline) { - super(httpPipeline); + this.httpPipeline = httpPipeline; this.services = new ServicesImpl(this); this.containers = new ContainersImpl(this); this.blobs = new BlobsImpl(this); diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java index e89e8972aed35..eba1efa297e4b 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java @@ -4,20 +4,22 @@ package com.azure.storage.blob.implementation; -import com.azure.core.annotations.DELETE; -import com.azure.core.annotations.ExpectedResponses; -import com.azure.core.annotations.GET; -import com.azure.core.annotations.HEAD; -import com.azure.core.annotations.HeaderParam; -import com.azure.core.annotations.Host; -import com.azure.core.annotations.HostParam; -import com.azure.core.annotations.PUT; -import com.azure.core.annotations.PathParam; -import com.azure.core.annotations.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; import com.azure.core.implementation.DateTimeRfc1123; import com.azure.core.implementation.RestProxy; +import com.azure.core.implementation.annotation.Delete; +import com.azure.core.implementation.annotation.ExpectedResponses; +import com.azure.core.implementation.annotation.Get; +import com.azure.core.implementation.annotation.Head; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.PathParam; +import com.azure.core.implementation.annotation.Put; +import com.azure.core.implementation.annotation.QueryParam; +import com.azure.core.implementation.annotation.ReturnType; +import com.azure.core.implementation.annotation.ServiceInterface; +import com.azure.core.implementation.annotation.ServiceMethod; +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; @@ -71,98 +73,98 @@ public final class BlobsImpl { * @param client the instance of the service client containing this operation class. */ public BlobsImpl(AzureBlobStorageImpl client) { - this.service = RestProxy.create(BlobsService.class, client); + this.service = RestProxy.create(BlobsService.class, client.getHttpPipeline()); this.client = client; } /** - * The interface defining all the services for Blobs to be used by the - * proxy service to perform REST calls. + * The interface defining all the services for AzureBlobStorageBlobs to be + * used by the proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Blobs") + @ServiceInterface(name = "AzureBlobStorageBlobs") private interface BlobsService { - @GET("{containerName}/{blob}") + @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); - @HEAD("{containerName}/{blob}") + @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); - @DELETE("{containerName}/{blob}") + @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("{containerName}/{blob}") + @Put("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono undelete(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); - @PUT("{containerName}/{blob}") + @Put("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono setHTTPHeaders(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @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-md5") String blobContentMD5, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @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); - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono acquireLease(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-duration") Integer duration, @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, @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}") + @Put("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono releaseLease(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, @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}") + @Put("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono renewLease(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, @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}") + @Put("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono changeLease(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, @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}") + @Put("{containerName}/{blob}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono breakLease(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-break-period") Integer breakPeriod, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-action") String action, @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}") + @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); - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @Put("{containerName}/{blob}") @ExpectedResponses({204}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono abortCopyFromURL(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("copyid") String copyId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-copy-action") String copyActionAbortConstant, @HeaderParam("x-ms-lease-id") String leaseId, Context context); - @PUT("{containerName}/{blob}") + @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); - @GET("{containerName}/{blob}") + @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); @@ -177,6 +179,7 @@ private interface BlobsService { * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono downloadWithRestResponseAsync(String containerName, String blob, Context context) { final String snapshot = null; final String versionId = null; @@ -192,7 +195,7 @@ public Mono downloadWithRestResponseAsync(String containe final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.download(containerName, blob, this.client.url(), snapshot, versionId, timeout, range, rangeGetContentMD5, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + 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); } /** @@ -215,6 +218,7 @@ public Mono downloadWithRestResponseAsync(String containe * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { String leaseId = null; if (leaseAccessConditions != null) { @@ -238,7 +242,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.url(), snapshot, versionId, timeout, range, rangeGetContentMD5, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + 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); } /** @@ -250,6 +254,7 @@ public Mono downloadWithRestResponseAsync(String containe * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesWithRestResponseAsync(String containerName, String blob, Context context) { final String snapshot = null; final String versionId = null; @@ -263,7 +268,7 @@ public Mono getPropertiesWithRestResponseAsync(Strin final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.getProperties(containerName, blob, this.client.url(), snapshot, versionId, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getProperties(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -284,6 +289,7 @@ public Mono getPropertiesWithRestResponseAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { String leaseId = null; if (leaseAccessConditions != null) { @@ -307,11 +313,11 @@ 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.url(), snapshot, versionId, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getProperties(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** - * If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, it is marked for deletion and becomes inaccessible immediately. However, the storage service retains the blob or snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until it is permanently removed. Use the List Blobs API and specify the "include=deleted" query parameter to discover which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP status code of 404 (ResourceNotFound). If the storage account's automatic snapshot feature is enabled, then, when a blob is deleted, an automatic snapshot is created. The blob becomes inaccessible immediately. All other operations on the blob causes the service to return an HTTP status code of 404 (ResourceNotFound). You can access automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC permissions. + * If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until it is permanently removed. Use the List Blobs API and specify the "include=deleted" query parameter to discover which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP status code of 404 (ResourceNotFound). If the storage account's automatic snapshot feature is enabled, then, when a blob is deleted, an automatic snapshot is created. The blob becomes inaccessible immediately. All other operations on the blob causes the service to return an HTTP status code of 404 (ResourceNotFound). You can access automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC permissions. * * @param containerName The container name. * @param blob The blob name. @@ -319,6 +325,7 @@ public Mono getPropertiesWithRestResponseAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteWithRestResponseAsync(String containerName, String blob, Context context) { final String snapshot = null; final String versionId = null; @@ -330,11 +337,11 @@ public Mono deleteWithRestResponseAsync(String containerNam final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.delete(containerName, blob, this.client.url(), snapshot, versionId, timeout, deleteSnapshots, this.client.version(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.delete(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, deleteSnapshots, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** - * If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, it is marked for deletion and becomes inaccessible immediately. However, the storage service retains the blob or snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until it is permanently removed. Use the List Blobs API and specify the "include=deleted" query parameter to discover which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP status code of 404 (ResourceNotFound). If the storage account's automatic snapshot feature is enabled, then, when a blob is deleted, an automatic snapshot is created. The blob becomes inaccessible immediately. All other operations on the blob causes the service to return an HTTP status code of 404 (ResourceNotFound). You can access automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC permissions. + * If the storage account's soft delete feature is disabled then, when a blob is deleted, it is permanently removed from the storage account. If the storage account's soft delete feature is enabled, then, when a blob is deleted, it is marked for deletion and becomes inaccessible immediately. However, the blob service retains the blob or snapshot for the number of days specified by the DeleteRetentionPolicy section of [Storage service properties] (Set-Blob-Service-Properties.md). After the specified number of days has passed, the blob's data is permanently removed from the storage account. Note that you continue to be charged for the soft-deleted blob's storage until it is permanently removed. Use the List Blobs API and specify the "include=deleted" query parameter to discover which blobs and snapshots have been soft deleted. You can then use the Undelete Blob API to restore a soft-deleted blob. All other operations on a soft-deleted blob or snapshot causes the service to return an HTTP status code of 404 (ResourceNotFound). If the storage account's automatic snapshot feature is enabled, then, when a blob is deleted, an automatic snapshot is created. The blob becomes inaccessible immediately. All other operations on the blob causes the service to return an HTTP status code of 404 (ResourceNotFound). You can access automatic snapshot using snapshot timestamp or version id. You can restore the blob by calling Put or Copy Blob API with automatic snapshot as source. Deleting automatic snapshot requires shared key or special SAS/RBAC permissions. * * @param containerName The container name. * @param blob The blob name. @@ -349,6 +356,7 @@ public Mono deleteWithRestResponseAsync(String containerNam * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteWithRestResponseAsync(String containerName, String blob, String snapshot, String versionId, Integer timeout, DeleteSnapshotsOptionType deleteSnapshots, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { String leaseId = null; if (leaseAccessConditions != null) { @@ -372,7 +380,7 @@ public Mono deleteWithRestResponseAsync(String containerNam } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.delete(containerName, blob, this.client.url(), snapshot, versionId, timeout, deleteSnapshots, this.client.version(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.delete(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, deleteSnapshots, this.client.getVersion(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -384,11 +392,12 @@ public Mono deleteWithRestResponseAsync(String containerNam * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono undeleteWithRestResponseAsync(String containerName, String blob, Context context) { final Integer timeout = null; final String requestId = null; final String comp = "undelete"; - return service.undelete(containerName, blob, this.client.url(), timeout, this.client.version(), requestId, comp, context); + return service.undelete(containerName, blob, this.client.getUrl(), timeout, this.client.getVersion(), requestId, comp, context); } /** @@ -402,9 +411,10 @@ public Mono undeleteWithRestResponseAsync(String containe * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono undeleteWithRestResponseAsync(String containerName, String blob, Integer timeout, String requestId, Context context) { final String comp = "undelete"; - return service.undelete(containerName, blob, this.client.url(), timeout, this.client.version(), requestId, comp, context); + return service.undelete(containerName, blob, this.client.getUrl(), timeout, this.client.getVersion(), requestId, comp, context); } /** @@ -416,6 +426,7 @@ public Mono undeleteWithRestResponseAsync(String containe * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono setHTTPHeadersWithRestResponseAsync(String containerName, String blob, Context context) { final Integer timeout = null; final String requestId = null; @@ -431,7 +442,7 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.setHTTPHeaders(containerName, blob, this.client.url(), timeout, this.client.version(), requestId, comp, blobCacheControl, blobContentType, blobContentMD5Converted, blobContentEncoding, blobContentLanguage, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.setHTTPHeaders(containerName, blob, this.client.getUrl(), timeout, this.client.getVersion(), requestId, comp, blobCacheControl, blobContentType, blobContentMD5Converted, blobContentEncoding, blobContentLanguage, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -448,6 +459,7 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono setHTTPHeadersWithRestResponseAsync(String containerName, String blob, Integer timeout, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "properties"; String blobCacheControl = null; @@ -497,7 +509,7 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str String blobContentMD5Converted = Base64Util.encodeToString(blobContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.setHTTPHeaders(containerName, blob, this.client.url(), timeout, this.client.version(), requestId, comp, blobCacheControl, blobContentType, blobContentMD5Converted, blobContentEncoding, blobContentLanguage, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.setHTTPHeaders(containerName, blob, this.client.getUrl(), timeout, this.client.getVersion(), requestId, comp, blobCacheControl, blobContentType, blobContentMD5Converted, blobContentEncoding, blobContentLanguage, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -509,6 +521,7 @@ public Mono setHTTPHeadersWithRestResponseAsync(Str * @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, Context context) { final Integer timeout = null; final Map metadata = null; @@ -522,7 +535,7 @@ public Mono setMetadataWithRestResponseAsync(String co final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.setMetadata(containerName, blob, this.client.url(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.setMetadata(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -542,6 +555,7 @@ public Mono setMetadataWithRestResponseAsync(String co * @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) { final String comp = "metadata"; String leaseId = null; @@ -566,7 +580,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.url(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.setMetadata(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -578,6 +592,7 @@ public Mono setMetadataWithRestResponseAsync(String co * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono acquireLeaseWithRestResponseAsync(String containerName, String blob, Context context) { final Integer timeout = null; final Integer duration = null; @@ -589,7 +604,7 @@ public Mono acquireLeaseWithRestResponseAsync(String final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.acquireLease(containerName, blob, this.client.url(), timeout, duration, proposedLeaseId, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.acquireLease(containerName, blob, this.client.getUrl(), timeout, duration, proposedLeaseId, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -606,6 +621,7 @@ public Mono acquireLeaseWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono acquireLeaseWithRestResponseAsync(String containerName, String blob, Integer timeout, Integer duration, String proposedLeaseId, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String action = "acquire"; @@ -627,7 +643,7 @@ public Mono acquireLeaseWithRestResponseAsync(String } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.acquireLease(containerName, blob, this.client.url(), timeout, duration, proposedLeaseId, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.acquireLease(containerName, blob, this.client.getUrl(), timeout, duration, proposedLeaseId, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -640,6 +656,7 @@ public Mono acquireLeaseWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono releaseLeaseWithRestResponseAsync(String containerName, String blob, String leaseId, Context context) { final Integer timeout = null; final String requestId = null; @@ -649,7 +666,7 @@ public Mono releaseLeaseWithRestResponseAsync(String final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.releaseLease(containerName, blob, this.client.url(), timeout, leaseId, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.releaseLease(containerName, blob, this.client.getUrl(), timeout, leaseId, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -665,6 +682,7 @@ public Mono releaseLeaseWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono releaseLeaseWithRestResponseAsync(String containerName, String blob, String leaseId, Integer timeout, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String action = "release"; @@ -686,7 +704,7 @@ public Mono releaseLeaseWithRestResponseAsync(String } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.releaseLease(containerName, blob, this.client.url(), timeout, leaseId, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.releaseLease(containerName, blob, this.client.getUrl(), timeout, leaseId, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -699,6 +717,7 @@ public Mono releaseLeaseWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono renewLeaseWithRestResponseAsync(String containerName, String blob, String leaseId, Context context) { final Integer timeout = null; final String requestId = null; @@ -708,7 +727,7 @@ public Mono renewLeaseWithRestResponseAsync(String cont final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.renewLease(containerName, blob, this.client.url(), timeout, leaseId, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.renewLease(containerName, blob, this.client.getUrl(), timeout, leaseId, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -724,6 +743,7 @@ public Mono renewLeaseWithRestResponseAsync(String cont * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono renewLeaseWithRestResponseAsync(String containerName, String blob, String leaseId, Integer timeout, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String action = "renew"; @@ -745,7 +765,7 @@ public Mono renewLeaseWithRestResponseAsync(String cont } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.renewLease(containerName, blob, this.client.url(), timeout, leaseId, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.renewLease(containerName, blob, this.client.getUrl(), timeout, leaseId, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -759,6 +779,7 @@ public Mono renewLeaseWithRestResponseAsync(String cont * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono changeLeaseWithRestResponseAsync(String containerName, String blob, String leaseId, String proposedLeaseId, Context context) { final Integer timeout = null; final String requestId = null; @@ -768,7 +789,7 @@ public Mono changeLeaseWithRestResponseAsync(String co final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.changeLease(containerName, blob, this.client.url(), timeout, leaseId, proposedLeaseId, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.changeLease(containerName, blob, this.client.getUrl(), timeout, leaseId, proposedLeaseId, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -785,6 +806,7 @@ public Mono changeLeaseWithRestResponseAsync(String co * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono changeLeaseWithRestResponseAsync(String containerName, String blob, String leaseId, String proposedLeaseId, Integer timeout, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String action = "change"; @@ -806,7 +828,7 @@ public Mono changeLeaseWithRestResponseAsync(String co } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.changeLease(containerName, blob, this.client.url(), timeout, leaseId, proposedLeaseId, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.changeLease(containerName, blob, this.client.getUrl(), timeout, leaseId, proposedLeaseId, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -818,6 +840,7 @@ public Mono changeLeaseWithRestResponseAsync(String co * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono breakLeaseWithRestResponseAsync(String containerName, String blob, Context context) { final Integer timeout = null; final Integer breakPeriod = null; @@ -828,7 +851,7 @@ public Mono breakLeaseWithRestResponseAsync(String cont final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.breakLease(containerName, blob, this.client.url(), timeout, breakPeriod, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.breakLease(containerName, blob, this.client.getUrl(), timeout, breakPeriod, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -844,6 +867,7 @@ public Mono breakLeaseWithRestResponseAsync(String cont * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono breakLeaseWithRestResponseAsync(String containerName, String blob, Integer timeout, Integer breakPeriod, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String action = "break"; @@ -865,7 +889,7 @@ public Mono breakLeaseWithRestResponseAsync(String cont } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.breakLease(containerName, blob, this.client.url(), timeout, breakPeriod, this.client.version(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.breakLease(containerName, blob, this.client.getUrl(), timeout, breakPeriod, this.client.getVersion(), requestId, comp, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -877,6 +901,7 @@ public Mono breakLeaseWithRestResponseAsync(String cont * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono createSnapshotWithRestResponseAsync(String containerName, String blob, Context context) { final Integer timeout = null; final Map metadata = null; @@ -890,7 +915,7 @@ public Mono createSnapshotWithRestResponseAsync(Str final String leaseId = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.createSnapshot(containerName, blob, this.client.url(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + return service.createSnapshot(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); } /** @@ -910,6 +935,7 @@ public Mono createSnapshotWithRestResponseAsync(Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { final String comp = "snapshot"; OffsetDateTime ifModifiedSince = null; @@ -934,7 +960,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.url(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + return service.createSnapshot(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); } /** @@ -947,6 +973,7 @@ public Mono createSnapshotWithRestResponseAsync(Str * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono startCopyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) { final Integer timeout = null; final Map metadata = null; @@ -960,7 +987,7 @@ public Mono startCopyFromURLWithRestResponseAsync DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.startCopyFromURL(containerName, blob, this.client.url(), timeout, metadata, copySource, this.client.version(), requestId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + 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); } /** @@ -979,6 +1006,7 @@ public Mono startCopyFromURLWithRestResponseAsync * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { OffsetDateTime sourceIfModifiedSince = null; if (sourceModifiedAccessConditions != null) { @@ -1020,7 +1048,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.url(), timeout, metadata, copySource, this.client.version(), requestId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + 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); } /** @@ -1033,6 +1061,7 @@ public Mono startCopyFromURLWithRestResponseAsync * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono copyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) { final Integer timeout = null; final Map metadata = null; @@ -1047,7 +1076,7 @@ public Mono copyFromURLWithRestResponseAsync(String co DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.copyFromURL(containerName, blob, this.client.url(), timeout, metadata, copySource, this.client.version(), requestId, xMsRequiresSync, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + 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); } /** @@ -1066,6 +1095,7 @@ public Mono copyFromURLWithRestResponseAsync(String co * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { final String xMsRequiresSync = "true"; OffsetDateTime sourceIfModifiedSince = null; @@ -1108,7 +1138,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.url(), timeout, metadata, copySource, this.client.version(), requestId, xMsRequiresSync, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); + 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); } /** @@ -1121,13 +1151,14 @@ public Mono copyFromURLWithRestResponseAsync(String co * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono abortCopyFromURLWithRestResponseAsync(String containerName, String blob, String copyId, Context context) { final Integer timeout = null; final String requestId = null; final String comp = "copy"; final String copyActionAbortConstant = "abort"; final String leaseId = null; - return service.abortCopyFromURL(containerName, blob, this.client.url(), copyId, timeout, this.client.version(), requestId, comp, copyActionAbortConstant, leaseId, context); + return service.abortCopyFromURL(containerName, blob, this.client.getUrl(), copyId, timeout, this.client.getVersion(), requestId, comp, copyActionAbortConstant, leaseId, context); } /** @@ -1143,6 +1174,7 @@ public Mono abortCopyFromURLWithRestResponseAsync * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono abortCopyFromURLWithRestResponseAsync(String containerName, String blob, String copyId, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { final String comp = "copy"; final String copyActionAbortConstant = "abort"; @@ -1150,7 +1182,7 @@ public Mono abortCopyFromURLWithRestResponseAsync if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } - return service.abortCopyFromURL(containerName, blob, this.client.url(), copyId, timeout, this.client.version(), requestId, comp, copyActionAbortConstant, leaseId, context); + return service.abortCopyFromURL(containerName, blob, this.client.getUrl(), copyId, timeout, this.client.getVersion(), requestId, comp, copyActionAbortConstant, leaseId, context); } /** @@ -1163,12 +1195,13 @@ public Mono abortCopyFromURLWithRestResponseAsync * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { final Integer timeout = null; final String requestId = null; final String comp = "tier"; final String leaseId = null; - return service.setTier(containerName, blob, this.client.url(), timeout, tier, this.client.version(), requestId, comp, leaseId, context); + return service.setTier(containerName, blob, this.client.getUrl(), timeout, tier, this.client.getVersion(), requestId, comp, leaseId, context); } /** @@ -1184,13 +1217,14 @@ public Mono setTierWithRestResponseAsync(String containerN * @throws IllegalArgumentException thrown if parameters fail the validation. * @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) { final String comp = "tier"; String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } - return service.setTier(containerName, blob, this.client.url(), timeout, tier, this.client.version(), requestId, comp, leaseId, context); + return service.setTier(containerName, blob, this.client.getUrl(), timeout, tier, this.client.getVersion(), requestId, comp, leaseId, context); } /** @@ -1202,9 +1236,10 @@ public Mono setTierWithRestResponseAsync(String containerN * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getAccountInfoWithRestResponseAsync(String containerName, String blob, Context context) { final String restype = "account"; final String comp = "properties"; - return service.getAccountInfo(containerName, blob, this.client.url(), this.client.version(), restype, comp, context); + return service.getAccountInfo(containerName, blob, this.client.getUrl(), this.client.getVersion(), restype, comp, context); } } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java index 2c4645d2bd4bc..390c2436de9a3 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java @@ -4,19 +4,21 @@ package com.azure.storage.blob.implementation; -import com.azure.core.annotations.BodyParam; -import com.azure.core.annotations.ExpectedResponses; -import com.azure.core.annotations.GET; -import com.azure.core.annotations.HeaderParam; -import com.azure.core.annotations.Host; -import com.azure.core.annotations.HostParam; -import com.azure.core.annotations.PUT; -import com.azure.core.annotations.PathParam; -import com.azure.core.annotations.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; 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.ExpectedResponses; +import com.azure.core.implementation.annotation.Get; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.PathParam; +import com.azure.core.implementation.annotation.Put; +import com.azure.core.implementation.annotation.QueryParam; +import com.azure.core.implementation.annotation.ReturnType; +import com.azure.core.implementation.annotation.ServiceInterface; +import com.azure.core.implementation.annotation.ServiceMethod; +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.BlobHTTPHeaders; @@ -33,12 +35,11 @@ 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 @@ -61,38 +62,38 @@ public final class BlockBlobsImpl { * @param client the instance of the service client containing this operation class. */ public BlockBlobsImpl(AzureBlobStorageImpl client) { - this.service = RestProxy.create(BlockBlobsService.class, client); + this.service = RestProxy.create(BlockBlobsService.class, client.getHttpPipeline()); this.client = client; } /** - * The interface defining all the services for BlockBlobs to be used by the - * proxy service to perform REST calls. + * The interface defining all the services for AzureBlobStorageBlockBlobs + * to be used by the proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Blobs BlockBlob") + @ServiceInterface(name = "AzureBlobStorageBlockBlobs") private interface BlockBlobsService { - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @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); - @PUT("{containerName}/{blob}") + @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); - @GET("{containerName}/{blob}") + @Get("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getBlockList(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("snapshot") String snapshot, @QueryParam("versionid") String versionId, @QueryParam("blocklisttype") BlockListType listType, @QueryParam("timeout") Integer timeout, @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); @@ -109,6 +110,7 @@ private interface BlockBlobsService { * @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, Context context) { final Integer timeout = null; final Map metadata = null; @@ -128,7 +130,7 @@ public Mono uploadWithRestResponseAsync(String contain String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.upload(containerName, blob, this.client.url(), body, timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), 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, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -151,6 +153,7 @@ public Mono uploadWithRestResponseAsync(String contain * @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) { final String blobType = "BlockBlob"; String blobContentType = null; @@ -200,7 +203,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.url(), body, timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), 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, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -215,6 +218,7 @@ public Mono uploadWithRestResponseAsync(String contain * @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, Context context) { final Integer timeout = null; final String encryptionKey = null; @@ -224,7 +228,7 @@ public Mono stageBlockWithRestResponseAsync(String final String comp = "block"; final String leaseId = null; String transactionalContentMD5Converted = null; - return service.stageBlock(containerName, blob, this.client.url(), blockId, contentLength, transactionalContentMD5Converted, body, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, leaseId, context); + return service.stageBlock(containerName, blob, this.client.getUrl(), blockId, contentLength, transactionalContentMD5Converted, body, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, context); } /** @@ -246,6 +250,7 @@ public Mono stageBlockWithRestResponseAsync(String * @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) { final String comp = "block"; String leaseId = null; @@ -253,7 +258,7 @@ public Mono stageBlockWithRestResponseAsync(String leaseId = leaseAccessConditions.leaseId(); } String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); - return service.stageBlock(containerName, blob, this.client.url(), blockId, contentLength, transactionalContentMD5Converted, body, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, leaseId, context); + return service.stageBlock(containerName, blob, this.client.getUrl(), blockId, contentLength, transactionalContentMD5Converted, body, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, leaseId, context); } /** @@ -268,6 +273,7 @@ public Mono stageBlockWithRestResponseAsync(String * @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, Context context) { final String sourceRange = null; final Integer timeout = null; @@ -282,7 +288,7 @@ public Mono stageBlockFromURLWithRestRespon String sourceContentMD5Converted = null; DateTimeRfc1123 sourceIfModifiedSinceConverted = null; DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; - return service.stageBlockFromURL(containerName, blob, this.client.url(), blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, leaseId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + 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); } /** @@ -306,6 +312,7 @@ public Mono stageBlockFromURLWithRestRespon * @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) { final String comp = "block"; String leaseId = null; @@ -331,7 +338,7 @@ public Mono stageBlockFromURLWithRestRespon String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.stageBlockFromURL(containerName, blob, this.client.url(), blockId, contentLength, sourceUrl, sourceRange, sourceContentMD5Converted, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, leaseId, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + 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); } /** @@ -344,6 +351,7 @@ public Mono stageBlockFromURLWithRestRespon * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono commitBlockListWithRestResponseAsync(String containerName, String blob, BlockLookupList blocks, Context context) { final Integer timeout = null; final Map metadata = null; @@ -363,7 +371,7 @@ public Mono commitBlockListWithRestResponseAs String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.commitBlockList(containerName, blob, this.client.url(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blocks, this.client.version(), requestId, comp, blobCacheControl, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.commitBlockList(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blocks, this.client.getVersion(), requestId, comp, blobCacheControl, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -385,6 +393,7 @@ public Mono commitBlockListWithRestResponseAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono commitBlockListWithRestResponseAsync(String containerName, String blob, BlockLookupList blocks, Integer timeout, Map metadata, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "blocklist"; String blobCacheControl = null; @@ -434,7 +443,7 @@ public Mono commitBlockListWithRestResponseAs String blobContentMD5Converted = Base64Util.encodeToString(blobContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.commitBlockList(containerName, blob, this.client.url(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blocks, this.client.version(), requestId, comp, blobCacheControl, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.commitBlockList(containerName, blob, this.client.getUrl(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blocks, this.client.getVersion(), requestId, comp, blobCacheControl, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -447,6 +456,7 @@ public Mono commitBlockListWithRestResponseAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getBlockListWithRestResponseAsync(String containerName, String blob, BlockListType listType, Context context) { final String snapshot = null; final String versionId = null; @@ -454,7 +464,7 @@ public Mono getBlockListWithRestResponseAsync(St final String requestId = null; final String comp = "blocklist"; final String leaseId = null; - return service.getBlockList(containerName, blob, this.client.url(), snapshot, versionId, listType, timeout, this.client.version(), requestId, comp, leaseId, context); + return service.getBlockList(containerName, blob, this.client.getUrl(), snapshot, versionId, listType, timeout, this.client.getVersion(), requestId, comp, leaseId, context); } /** @@ -472,12 +482,13 @@ public Mono getBlockListWithRestResponseAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getBlockListWithRestResponseAsync(String containerName, String blob, BlockListType listType, String snapshot, String versionId, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { final String comp = "blocklist"; String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } - return service.getBlockList(containerName, blob, this.client.url(), snapshot, versionId, listType, timeout, this.client.version(), requestId, comp, leaseId, context); + return service.getBlockList(containerName, blob, this.client.getUrl(), snapshot, versionId, listType, timeout, this.client.getVersion(), requestId, comp, leaseId, context); } } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java index 780b3a356a619..598e19f68192a 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java @@ -4,21 +4,23 @@ package com.azure.storage.blob.implementation; -import com.azure.core.annotations.BodyParam; -import com.azure.core.annotations.DELETE; -import com.azure.core.annotations.ExpectedResponses; -import com.azure.core.annotations.GET; -import com.azure.core.annotations.HeaderParam; -import com.azure.core.annotations.Host; -import com.azure.core.annotations.HostParam; -import com.azure.core.annotations.PUT; -import com.azure.core.annotations.PathParam; -import com.azure.core.annotations.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; import com.azure.core.implementation.CollectionFormat; 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; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.PathParam; +import com.azure.core.implementation.annotation.Put; +import com.azure.core.implementation.annotation.QueryParam; +import com.azure.core.implementation.annotation.ReturnType; +import com.azure.core.implementation.annotation.ServiceInterface; +import com.azure.core.implementation.annotation.ServiceMethod; +import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType; import com.azure.core.implementation.serializer.jackson.JacksonAdapter; import com.azure.core.util.Context; import com.azure.storage.blob.models.ContainersAcquireLeaseResponse; @@ -41,11 +43,10 @@ import com.azure.storage.blob.models.PublicAccessType; import com.azure.storage.blob.models.SignedIdentifier; import com.azure.storage.blob.models.StorageErrorException; -import reactor.core.publisher.Mono; - import java.time.OffsetDateTime; import java.util.List; import java.util.Map; +import reactor.core.publisher.Mono; /** * An instance of this class provides access to all the operations defined in @@ -68,83 +69,83 @@ public final class ContainersImpl { * @param client the instance of the service client containing this operation class. */ public ContainersImpl(AzureBlobStorageImpl client) { - this.service = RestProxy.create(ContainersService.class, client); + this.service = RestProxy.create(ContainersService.class, client.getHttpPipeline()); this.client = client; } /** - * The interface defining all the services for Containers to be used by the - * proxy service to perform REST calls. + * The interface defining all the services for AzureBlobStorageContainers + * to be used by the proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Blobs Containers") + @ServiceInterface(name = "AzureBlobStorageContainers") private interface ContainersService { - @PUT("{containerName}") + @Put("{containerName}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono create(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-blob-public-access") PublicAccessType access, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, Context context); - @GET("{containerName}") + @Get("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getProperties(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-id") String leaseId, Context context); - @DELETE("{containerName}") + @Delete("{containerName}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono delete(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); - @PUT("{containerName}") + @Put("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono setMetadata(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, Context context); - @GET("{containerName}") + @Get("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getAccessPolicy(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, Context context); - @PUT("{containerName}") + @Put("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setAccessPolicy(@PathParam("containerName") String containerName, @HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") SignedIdentifiersWrapper containerAcl, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-blob-public-access") PublicAccessType access, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); + Mono setAccessPolicy(@PathParam("containerName") String containerName, @HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") SignedIdentifierWrapper containerAcl, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-blob-public-access") PublicAccessType access, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); - @PUT("{containerName}") + @Put("{containerName}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono acquireLease(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-duration") Integer duration, @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); - @PUT("{containerName}") + @Put("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono releaseLease(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); - @PUT("{containerName}") + @Put("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono renewLease(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); - @PUT("{containerName}") + @Put("{containerName}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono breakLease(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-break-period") Integer breakPeriod, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); - @PUT("{containerName}") + @Put("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono changeLease(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-proposed-lease-id") String proposedLeaseId, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @QueryParam("restype") String restype, @HeaderParam("x-ms-lease-action") String action, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, Context context); - @GET("{containerName}") + @Get("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono listBlobFlatSegment(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); - @GET("{containerName}") + @Get("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono listBlobHierarchySegment(@PathParam("containerName") String containerName, @HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("delimiter") String delimiter, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") String include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); - @GET("{containerName}") + @Get("{containerName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getAccountInfo(@PathParam("containerName") String containerName, @HostParam("url") String url, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @@ -158,13 +159,14 @@ private interface ContainersService { * @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, Context context) { final Integer timeout = null; final Map metadata = null; final PublicAccessType access = null; final String requestId = null; final String restype = "container"; - return service.create(containerName, this.client.url(), timeout, metadata, access, this.client.version(), requestId, restype, context); + return service.create(containerName, this.client.getUrl(), timeout, metadata, access, this.client.getVersion(), requestId, restype, context); } /** @@ -179,9 +181,10 @@ public Mono createWithRestResponseAsync(String contain * @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, Integer timeout, Map metadata, PublicAccessType access, String requestId, Context context) { final String restype = "container"; - return service.create(containerName, this.client.url(), timeout, metadata, access, this.client.version(), requestId, restype, context); + return service.create(containerName, this.client.getUrl(), timeout, metadata, access, this.client.getVersion(), requestId, restype, context); } /** @@ -192,12 +195,13 @@ public Mono createWithRestResponseAsync(String contain * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesWithRestResponseAsync(String containerName, Context context) { final Integer timeout = null; final String requestId = null; final String restype = "container"; final String leaseId = null; - return service.getProperties(containerName, this.client.url(), timeout, this.client.version(), requestId, restype, leaseId, context); + return service.getProperties(containerName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, leaseId, context); } /** @@ -211,13 +215,14 @@ public Mono getPropertiesWithRestResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesWithRestResponseAsync(String containerName, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { final String restype = "container"; String leaseId = null; if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } - return service.getProperties(containerName, this.client.url(), timeout, this.client.version(), requestId, restype, leaseId, context); + return service.getProperties(containerName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, leaseId, context); } /** @@ -228,6 +233,7 @@ public Mono getPropertiesWithRestResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteWithRestResponseAsync(String containerName, Context context) { final Integer timeout = null; final String requestId = null; @@ -235,7 +241,7 @@ public Mono deleteWithRestResponseAsync(String contain final String leaseId = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.delete(containerName, this.client.url(), timeout, this.client.version(), requestId, restype, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.delete(containerName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -250,6 +256,7 @@ public Mono deleteWithRestResponseAsync(String contain * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono deleteWithRestResponseAsync(String containerName, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String restype = "container"; String leaseId = null; @@ -266,7 +273,7 @@ public Mono deleteWithRestResponseAsync(String contain } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.delete(containerName, this.client.url(), timeout, this.client.version(), requestId, restype, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.delete(containerName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -277,6 +284,7 @@ public Mono deleteWithRestResponseAsync(String contain * @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, Context context) { final Integer timeout = null; final Map metadata = null; @@ -285,7 +293,7 @@ public Mono setMetadataWithRestResponseAsync(Stri final String comp = "metadata"; final String leaseId = null; DateTimeRfc1123 ifModifiedSinceConverted = null; - return service.setMetadata(containerName, this.client.url(), timeout, metadata, this.client.version(), requestId, restype, comp, leaseId, ifModifiedSinceConverted, context); + return service.setMetadata(containerName, this.client.getUrl(), timeout, metadata, this.client.getVersion(), requestId, restype, comp, leaseId, ifModifiedSinceConverted, context); } /** @@ -301,6 +309,7 @@ public Mono setMetadataWithRestResponseAsync(Stri * @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, Integer timeout, Map metadata, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String restype = "container"; final String comp = "metadata"; @@ -313,7 +322,7 @@ public Mono setMetadataWithRestResponseAsync(Stri ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); - return service.setMetadata(containerName, this.client.url(), timeout, metadata, this.client.version(), requestId, restype, comp, leaseId, ifModifiedSinceConverted, context); + return service.setMetadata(containerName, this.client.getUrl(), timeout, metadata, this.client.getVersion(), requestId, restype, comp, leaseId, ifModifiedSinceConverted, context); } /** @@ -324,13 +333,14 @@ public Mono setMetadataWithRestResponseAsync(Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getAccessPolicyWithRestResponseAsync(String containerName, Context context) { final Integer timeout = null; final String requestId = null; final String restype = "container"; final String comp = "acl"; final String leaseId = null; - return service.getAccessPolicy(containerName, this.client.url(), timeout, this.client.version(), requestId, restype, comp, leaseId, context); + return service.getAccessPolicy(containerName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, comp, leaseId, context); } /** @@ -344,6 +354,7 @@ public Mono getAccessPolicyWithRestResponseAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getAccessPolicyWithRestResponseAsync(String containerName, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { final String restype = "container"; final String comp = "acl"; @@ -351,7 +362,7 @@ public Mono getAccessPolicyWithRestResponseAs if (leaseAccessConditions != null) { leaseId = leaseAccessConditions.leaseId(); } - return service.getAccessPolicy(containerName, this.client.url(), timeout, this.client.version(), requestId, restype, comp, leaseId, context); + return service.getAccessPolicy(containerName, this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, comp, leaseId, context); } /** @@ -362,6 +373,7 @@ public Mono getAccessPolicyWithRestResponseAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono setAccessPolicyWithRestResponseAsync(String containerName, Context context) { final Integer timeout = null; final PublicAccessType access = null; @@ -369,10 +381,10 @@ public Mono setAccessPolicyWithRestResponseAs final String restype = "container"; final String comp = "acl"; final String leaseId = null; - SignedIdentifiersWrapper containerAclConverted = new SignedIdentifiersWrapper(null); + SignedIdentifierWrapper containerAclConverted = new SignedIdentifierWrapper(null); DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.setAccessPolicy(containerName, this.client.url(), containerAclConverted, timeout, access, this.client.version(), requestId, restype, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.setAccessPolicy(containerName, this.client.getUrl(), containerAclConverted, timeout, access, this.client.getVersion(), requestId, restype, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -389,6 +401,7 @@ public Mono setAccessPolicyWithRestResponseAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono setAccessPolicyWithRestResponseAsync(String containerName, List containerAcl, Integer timeout, PublicAccessType access, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String restype = "container"; final String comp = "acl"; @@ -404,10 +417,10 @@ public Mono setAccessPolicyWithRestResponseAs if (modifiedAccessConditions != null) { ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); } - SignedIdentifiersWrapper containerAclConverted = new SignedIdentifiersWrapper(containerAcl); + SignedIdentifierWrapper containerAclConverted = new SignedIdentifierWrapper(containerAcl); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.setAccessPolicy(containerName, this.client.url(), containerAclConverted, timeout, access, this.client.version(), requestId, restype, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.setAccessPolicy(containerName, this.client.getUrl(), containerAclConverted, timeout, access, this.client.getVersion(), requestId, restype, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -418,6 +431,7 @@ public Mono setAccessPolicyWithRestResponseAs * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono acquireLeaseWithRestResponseAsync(String containerName, Context context) { final Integer timeout = null; final Integer duration = null; @@ -428,7 +442,7 @@ public Mono acquireLeaseWithRestResponseAsync(St final String action = "acquire"; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.acquireLease(containerName, this.client.url(), timeout, duration, proposedLeaseId, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.acquireLease(containerName, this.client.getUrl(), timeout, duration, proposedLeaseId, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -444,6 +458,7 @@ public Mono acquireLeaseWithRestResponseAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono acquireLeaseWithRestResponseAsync(String containerName, Integer timeout, Integer duration, String proposedLeaseId, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String restype = "container"; @@ -458,7 +473,7 @@ public Mono acquireLeaseWithRestResponseAsync(St } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.acquireLease(containerName, this.client.url(), timeout, duration, proposedLeaseId, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.acquireLease(containerName, this.client.getUrl(), timeout, duration, proposedLeaseId, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -470,6 +485,7 @@ public Mono acquireLeaseWithRestResponseAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono releaseLeaseWithRestResponseAsync(String containerName, String leaseId, Context context) { final Integer timeout = null; final String requestId = null; @@ -478,7 +494,7 @@ public Mono releaseLeaseWithRestResponseAsync(St final String action = "release"; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.releaseLease(containerName, this.client.url(), timeout, leaseId, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.releaseLease(containerName, this.client.getUrl(), timeout, leaseId, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -493,6 +509,7 @@ public Mono releaseLeaseWithRestResponseAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono releaseLeaseWithRestResponseAsync(String containerName, String leaseId, Integer timeout, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String restype = "container"; @@ -507,7 +524,7 @@ public Mono releaseLeaseWithRestResponseAsync(St } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.releaseLease(containerName, this.client.url(), timeout, leaseId, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.releaseLease(containerName, this.client.getUrl(), timeout, leaseId, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -519,6 +536,7 @@ public Mono releaseLeaseWithRestResponseAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono renewLeaseWithRestResponseAsync(String containerName, String leaseId, Context context) { final Integer timeout = null; final String requestId = null; @@ -527,7 +545,7 @@ public Mono renewLeaseWithRestResponseAsync(String final String action = "renew"; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.renewLease(containerName, this.client.url(), timeout, leaseId, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.renewLease(containerName, this.client.getUrl(), timeout, leaseId, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -542,6 +560,7 @@ public Mono renewLeaseWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono renewLeaseWithRestResponseAsync(String containerName, String leaseId, Integer timeout, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String restype = "container"; @@ -556,7 +575,7 @@ public Mono renewLeaseWithRestResponseAsync(String } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.renewLease(containerName, this.client.url(), timeout, leaseId, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.renewLease(containerName, this.client.getUrl(), timeout, leaseId, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -567,6 +586,7 @@ public Mono renewLeaseWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono breakLeaseWithRestResponseAsync(String containerName, Context context) { final Integer timeout = null; final Integer breakPeriod = null; @@ -576,7 +596,7 @@ public Mono breakLeaseWithRestResponseAsync(String final String action = "break"; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.breakLease(containerName, this.client.url(), timeout, breakPeriod, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.breakLease(containerName, this.client.getUrl(), timeout, breakPeriod, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -591,6 +611,7 @@ public Mono breakLeaseWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono breakLeaseWithRestResponseAsync(String containerName, Integer timeout, Integer breakPeriod, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String restype = "container"; @@ -605,7 +626,7 @@ public Mono breakLeaseWithRestResponseAsync(String } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.breakLease(containerName, this.client.url(), timeout, breakPeriod, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.breakLease(containerName, this.client.getUrl(), timeout, breakPeriod, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -618,6 +639,7 @@ public Mono breakLeaseWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono changeLeaseWithRestResponseAsync(String containerName, String leaseId, String proposedLeaseId, Context context) { final Integer timeout = null; final String requestId = null; @@ -626,7 +648,7 @@ public Mono changeLeaseWithRestResponseAsync(Stri final String action = "change"; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.changeLease(containerName, this.client.url(), timeout, leaseId, proposedLeaseId, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.changeLease(containerName, this.client.getUrl(), timeout, leaseId, proposedLeaseId, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -642,6 +664,7 @@ public Mono changeLeaseWithRestResponseAsync(Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono changeLeaseWithRestResponseAsync(String containerName, String leaseId, String proposedLeaseId, Integer timeout, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "lease"; final String restype = "container"; @@ -656,7 +679,7 @@ public Mono changeLeaseWithRestResponseAsync(Stri } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.changeLease(containerName, this.client.url(), timeout, leaseId, proposedLeaseId, this.client.version(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); + return service.changeLease(containerName, this.client.getUrl(), timeout, leaseId, proposedLeaseId, this.client.getVersion(), requestId, comp, restype, action, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, context); } /** @@ -667,6 +690,7 @@ public Mono changeLeaseWithRestResponseAsync(Stri * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono listBlobFlatSegmentWithRestResponseAsync(String containerName, Context context) { final String prefix = null; final String marker = null; @@ -676,7 +700,7 @@ public Mono listBlobFlatSegmentWithRestRe final String restype = "container"; final String comp = "list"; String includeConverted = null; - return service.listBlobFlatSegment(containerName, this.client.url(), prefix, marker, maxresults, includeConverted, timeout, this.client.version(), requestId, restype, comp, context); + return service.listBlobFlatSegment(containerName, this.client.getUrl(), prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -693,11 +717,12 @@ public Mono listBlobFlatSegmentWithRestRe * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono listBlobFlatSegmentWithRestResponseAsync(String containerName, String prefix, String marker, Integer maxresults, List include, Integer timeout, String requestId, Context context) { final String restype = "container"; final String comp = "list"; String includeConverted = JacksonAdapter.createDefaultSerializerAdapter().serializeList(include, CollectionFormat.CSV); - return service.listBlobFlatSegment(containerName, this.client.url(), prefix, marker, maxresults, includeConverted, timeout, this.client.version(), requestId, restype, comp, context); + return service.listBlobFlatSegment(containerName, this.client.getUrl(), prefix, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -709,6 +734,7 @@ public Mono listBlobFlatSegmentWithRestRe * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono listBlobHierarchySegmentWithRestResponseAsync(String containerName, String delimiter, Context context) { final String prefix = null; final String marker = null; @@ -718,7 +744,7 @@ public Mono listBlobHierarchySegment final String restype = "container"; final String comp = "list"; String includeConverted = null; - return service.listBlobHierarchySegment(containerName, this.client.url(), prefix, delimiter, marker, maxresults, includeConverted, timeout, this.client.version(), requestId, restype, comp, context); + return service.listBlobHierarchySegment(containerName, this.client.getUrl(), prefix, delimiter, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -736,11 +762,12 @@ public Mono listBlobHierarchySegment * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono listBlobHierarchySegmentWithRestResponseAsync(String containerName, String delimiter, String prefix, String marker, Integer maxresults, List include, Integer timeout, String requestId, Context context) { final String restype = "container"; final String comp = "list"; String includeConverted = JacksonAdapter.createDefaultSerializerAdapter().serializeList(include, CollectionFormat.CSV); - return service.listBlobHierarchySegment(containerName, this.client.url(), prefix, delimiter, marker, maxresults, includeConverted, timeout, this.client.version(), requestId, restype, comp, context); + return service.listBlobHierarchySegment(containerName, this.client.getUrl(), prefix, delimiter, marker, maxresults, includeConverted, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -751,9 +778,10 @@ public Mono listBlobHierarchySegment * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getAccountInfoWithRestResponseAsync(String containerName, Context context) { final String restype = "account"; final String comp = "properties"; - return service.getAccountInfo(containerName, this.client.url(), this.client.version(), restype, comp, context); + return service.getAccountInfo(containerName, this.client.getUrl(), this.client.getVersion(), restype, comp, context); } } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java index f6f6d23380cd6..97dd44b22bc54 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java @@ -4,19 +4,21 @@ package com.azure.storage.blob.implementation; -import com.azure.core.annotations.BodyParam; -import com.azure.core.annotations.ExpectedResponses; -import com.azure.core.annotations.GET; -import com.azure.core.annotations.HeaderParam; -import com.azure.core.annotations.Host; -import com.azure.core.annotations.HostParam; -import com.azure.core.annotations.PUT; -import com.azure.core.annotations.PathParam; -import com.azure.core.annotations.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; 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.ExpectedResponses; +import com.azure.core.implementation.annotation.Get; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.PathParam; +import com.azure.core.implementation.annotation.Put; +import com.azure.core.implementation.annotation.QueryParam; +import com.azure.core.implementation.annotation.ReturnType; +import com.azure.core.implementation.annotation.ServiceInterface; +import com.azure.core.implementation.annotation.ServiceMethod; +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.BlobHTTPHeaders; @@ -37,12 +39,11 @@ 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 @@ -65,58 +66,58 @@ public final class PageBlobsImpl { * @param client the instance of the service client containing this operation class. */ public PageBlobsImpl(AzureBlobStorageImpl client) { - this.service = RestProxy.create(PageBlobsService.class, client); + this.service = RestProxy.create(PageBlobsService.class, client.getHttpPipeline()); this.client = client; } /** - * The interface defining all the services for PageBlobs to be used by the - * proxy service to perform REST calls. + * The interface defining all the services for AzureBlobStoragePageBlobs to + * be used by the proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Blobs PageBlobs") + @ServiceInterface(name = "AzureBlobStoragePageBlobs") private interface PageBlobsService { - @PUT("{containerName}/{blob}") + @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-blob-content-length") long blobContentLength, @HeaderParam("x-ms-blob-sequence-number") Long blobSequenceNumber, @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); - @PUT("{containerName}/{blob}") + @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono uploadPages(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String transactionalContentMD5, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @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-page-write") String pageWrite, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, @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}") + @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono clearPages(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @HeaderParam("Content-Length") long contentLength, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-page-write") String pageWrite, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, @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}") + @Put("{containerName}/{blob}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono uploadPagesFromURL(@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("Content-Length") long contentLength, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, @HeaderParam("x-ms-page-write") String pageWrite, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("x-ms-if-sequence-number-le") Long ifSequenceNumberLessThanOrEqualTo, @HeaderParam("x-ms-if-sequence-number-lt") Long ifSequenceNumberLessThan, @HeaderParam("x-ms-if-sequence-number-eq") Long ifSequenceNumberEqualTo, @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); - @GET("{containerName}/{blob}") + @Get("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getPageRanges(@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-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); - @GET("{containerName}/{blob}") + @Get("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getPageRangesDiff(@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("prevsnapshot") String prevsnapshot, @HeaderParam("x-ms-range") String range, @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); - @PUT("{containerName}/{blob}") + @Put("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono resize(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-blob-content-length") long blobContentLength, @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); - @PUT("{containerName}/{blob}") + @Put("{containerName}/{blob}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono updateSequenceNumber(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-sequence-number-action") SequenceNumberActionType sequenceNumberAction, @HeaderParam("x-ms-blob-sequence-number") Long blobSequenceNumber, @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); - @PUT("{containerName}/{blob}") + @Put("{containerName}/{blob}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono copyIncremental(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-copy-source") URL copySource, @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, Context context); @@ -133,6 +134,7 @@ private interface PageBlobsService { * @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, long blobContentLength, Context context) { final Integer timeout = null; final Map metadata = null; @@ -153,7 +155,7 @@ public Mono createWithRestResponseAsync(String containe String blobContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.create(containerName, blob, this.client.url(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blobContentLength, blobSequenceNumber, this.client.version(), 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, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blobContentLength, blobSequenceNumber, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -177,6 +179,7 @@ public Mono createWithRestResponseAsync(String containe * @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, long blobContentLength, Integer timeout, Map metadata, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, Long blobSequenceNumber, String requestId, BlobHTTPHeaders blobHTTPHeaders, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String blobType = "PageBlob"; String blobContentType = null; @@ -226,7 +229,7 @@ public Mono createWithRestResponseAsync(String containe 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.url(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blobContentLength, blobSequenceNumber, this.client.version(), 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, encryptionKey, encryptionKeySha256, encryptionAlgorithm, blobContentLength, blobSequenceNumber, this.client.getVersion(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -240,6 +243,7 @@ public Mono createWithRestResponseAsync(String containe * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono uploadPagesWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Context context) { final Integer timeout = null; final String range = null; @@ -258,7 +262,7 @@ public Mono uploadPagesWithRestResponseAsync(Strin String transactionalContentMD5Converted = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.uploadPages(containerName, blob, this.client.url(), body, contentLength, transactionalContentMD5Converted, timeout, range, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.uploadPages(containerName, blob, this.client.getUrl(), body, contentLength, transactionalContentMD5Converted, timeout, range, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -282,6 +286,7 @@ public Mono uploadPagesWithRestResponseAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono uploadPagesWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, byte[] transactionalContentMD5, Integer timeout, String range, String encryptionKey, String encryptionKeySha256, EncryptionAlgorithmType encryptionAlgorithm, String requestId, LeaseAccessConditions leaseAccessConditions, SequenceNumberAccessConditions sequenceNumberAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "page"; final String pageWrite = "update"; @@ -320,7 +325,7 @@ public Mono uploadPagesWithRestResponseAsync(Strin String transactionalContentMD5Converted = Base64Util.encodeToString(transactionalContentMD5); DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.uploadPages(containerName, blob, this.client.url(), body, contentLength, transactionalContentMD5Converted, timeout, range, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.uploadPages(containerName, blob, this.client.getUrl(), body, contentLength, transactionalContentMD5Converted, timeout, range, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -333,6 +338,7 @@ public Mono uploadPagesWithRestResponseAsync(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono clearPagesWithRestResponseAsync(String containerName, String blob, long contentLength, Context context) { final Integer timeout = null; final String range = null; @@ -347,7 +353,7 @@ public Mono clearPagesWithRestResponseAsync(String final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.clearPages(containerName, blob, this.client.url(), contentLength, timeout, range, this.client.version(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.clearPages(containerName, blob, this.client.getUrl(), contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -366,6 +372,7 @@ public Mono clearPagesWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono clearPagesWithRestResponseAsync(String containerName, String blob, long contentLength, Integer timeout, String range, String requestId, LeaseAccessConditions leaseAccessConditions, SequenceNumberAccessConditions sequenceNumberAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "page"; final String pageWrite = "clear"; @@ -403,7 +410,7 @@ public Mono clearPagesWithRestResponseAsync(String } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.clearPages(containerName, blob, this.client.url(), contentLength, timeout, range, this.client.version(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.clearPages(containerName, blob, this.client.getUrl(), contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -419,6 +426,7 @@ public Mono clearPagesWithRestResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono uploadPagesFromURLWithRestResponseAsync(String containerName, String blob, URL sourceUrl, String sourceRange, long contentLength, String range, Context context) { final Integer timeout = null; final String requestId = null; @@ -437,7 +445,7 @@ public Mono uploadPagesFromURLWithRestRespo DateTimeRfc1123 ifUnmodifiedSinceConverted = null; DateTimeRfc1123 sourceIfModifiedSinceConverted = null; DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = null; - return service.uploadPagesFromURL(containerName, blob, this.client.url(), sourceUrl, sourceRange, sourceContentMD5Converted, contentLength, timeout, range, this.client.version(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + return service.uploadPagesFromURL(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -460,6 +468,7 @@ public Mono uploadPagesFromURLWithRestRespo * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono uploadPagesFromURLWithRestResponseAsync(String containerName, String blob, URL sourceUrl, String sourceRange, long contentLength, String range, byte[] sourceContentMD5, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, SequenceNumberAccessConditions sequenceNumberAccessConditions, ModifiedAccessConditions modifiedAccessConditions, SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { final String comp = "page"; final String pageWrite = "update"; @@ -516,7 +525,7 @@ public Mono uploadPagesFromURLWithRestRespo 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.uploadPagesFromURL(containerName, blob, this.client.url(), sourceUrl, sourceRange, sourceContentMD5Converted, contentLength, timeout, range, this.client.version(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); + return service.uploadPagesFromURL(containerName, blob, this.client.getUrl(), sourceUrl, sourceRange, sourceContentMD5Converted, contentLength, timeout, range, this.client.getVersion(), requestId, comp, pageWrite, leaseId, ifSequenceNumberLessThanOrEqualTo, ifSequenceNumberLessThan, ifSequenceNumberEqualTo, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); } /** @@ -528,6 +537,7 @@ public Mono uploadPagesFromURLWithRestRespo * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPageRangesWithRestResponseAsync(String containerName, String blob, Context context) { final String snapshot = null; final String versionId = null; @@ -540,7 +550,7 @@ public Mono getPageRangesWithRestResponseAsync(S final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.getPageRanges(containerName, blob, this.client.url(), snapshot, versionId, timeout, range, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getPageRanges(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -559,6 +569,7 @@ public Mono getPageRangesWithRestResponseAsync(S * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPageRangesWithRestResponseAsync(String containerName, String blob, String snapshot, String versionId, Integer timeout, String range, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "pagelist"; String leaseId = null; @@ -583,7 +594,7 @@ public Mono getPageRangesWithRestResponseAsync(S } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getPageRanges(containerName, blob, this.client.url(), snapshot, versionId, timeout, range, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getPageRanges(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -595,6 +606,7 @@ public Mono getPageRangesWithRestResponseAsync(S * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPageRangesDiffWithRestResponseAsync(String containerName, String blob, Context context) { final String snapshot = null; final String versionId = null; @@ -608,7 +620,7 @@ public Mono getPageRangesDiffWithRestRespons final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.getPageRangesDiff(containerName, blob, this.client.url(), snapshot, versionId, timeout, prevsnapshot, range, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getPageRangesDiff(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, prevsnapshot, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -628,6 +640,7 @@ public Mono getPageRangesDiffWithRestRespons * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPageRangesDiffWithRestResponseAsync(String containerName, String blob, String snapshot, String versionId, Integer timeout, String prevsnapshot, String range, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "pagelist"; String leaseId = null; @@ -652,7 +665,7 @@ public Mono getPageRangesDiffWithRestRespons } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.getPageRangesDiff(containerName, blob, this.client.url(), snapshot, versionId, timeout, prevsnapshot, range, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.getPageRangesDiff(containerName, blob, this.client.getUrl(), snapshot, versionId, timeout, prevsnapshot, range, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -665,6 +678,7 @@ public Mono getPageRangesDiffWithRestRespons * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono resizeWithRestResponseAsync(String containerName, String blob, long blobContentLength, Context context) { final Integer timeout = null; final String requestId = null; @@ -674,7 +688,7 @@ public Mono resizeWithRestResponseAsync(String containe final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.resize(containerName, blob, this.client.url(), timeout, blobContentLength, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.resize(containerName, blob, this.client.getUrl(), timeout, blobContentLength, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -691,6 +705,7 @@ public Mono resizeWithRestResponseAsync(String containe * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono resizeWithRestResponseAsync(String containerName, String blob, long blobContentLength, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "properties"; String leaseId = null; @@ -715,7 +730,7 @@ public Mono resizeWithRestResponseAsync(String containe } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.resize(containerName, blob, this.client.url(), timeout, blobContentLength, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.resize(containerName, blob, this.client.getUrl(), timeout, blobContentLength, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -728,6 +743,7 @@ public Mono resizeWithRestResponseAsync(String containe * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono updateSequenceNumberWithRestResponseAsync(String containerName, String blob, SequenceNumberActionType sequenceNumberAction, Context context) { final Integer timeout = null; final Long blobSequenceNumber = 0L; @@ -738,7 +754,7 @@ public Mono updateSequenceNumberWithRestR final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.updateSequenceNumber(containerName, blob, this.client.url(), timeout, sequenceNumberAction, blobSequenceNumber, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.updateSequenceNumber(containerName, blob, this.client.getUrl(), timeout, sequenceNumberAction, blobSequenceNumber, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -756,6 +772,7 @@ public Mono updateSequenceNumberWithRestR * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono updateSequenceNumberWithRestResponseAsync(String containerName, String blob, SequenceNumberActionType sequenceNumberAction, Integer timeout, Long blobSequenceNumber, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "properties"; String leaseId = null; @@ -780,7 +797,7 @@ public Mono updateSequenceNumberWithRestR } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.updateSequenceNumber(containerName, blob, this.client.url(), timeout, sequenceNumberAction, blobSequenceNumber, this.client.version(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.updateSequenceNumber(containerName, blob, this.client.getUrl(), timeout, sequenceNumberAction, blobSequenceNumber, this.client.getVersion(), requestId, comp, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -793,6 +810,7 @@ public Mono updateSequenceNumberWithRestR * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono copyIncrementalWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) { final Integer timeout = null; final String requestId = null; @@ -801,7 +819,7 @@ public Mono copyIncrementalWithRestResponseAsy final String ifNoneMatch = null; DateTimeRfc1123 ifModifiedSinceConverted = null; DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.copyIncremental(containerName, blob, this.client.url(), timeout, copySource, this.client.version(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.copyIncremental(containerName, blob, this.client.getUrl(), timeout, copySource, this.client.getVersion(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } /** @@ -817,6 +835,7 @@ public Mono copyIncrementalWithRestResponseAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono copyIncrementalWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { final String comp = "incrementalcopy"; OffsetDateTime ifModifiedSince = null; @@ -837,6 +856,6 @@ public Mono copyIncrementalWithRestResponseAsy } DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - return service.copyIncremental(containerName, blob, this.client.url(), timeout, copySource, this.client.version(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); + return service.copyIncremental(containerName, blob, this.client.getUrl(), timeout, copySource, this.client.getVersion(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); } } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java index a31982006724c..5d77ec9bcee0d 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java @@ -4,18 +4,20 @@ package com.azure.storage.blob.implementation; -import com.azure.core.annotations.BodyParam; -import com.azure.core.annotations.ExpectedResponses; -import com.azure.core.annotations.GET; -import com.azure.core.annotations.HeaderParam; -import com.azure.core.annotations.Host; -import com.azure.core.annotations.HostParam; -import com.azure.core.annotations.POST; -import com.azure.core.annotations.PUT; -import com.azure.core.annotations.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; import com.azure.core.implementation.RestProxy; +import com.azure.core.implementation.annotation.BodyParam; +import com.azure.core.implementation.annotation.ExpectedResponses; +import com.azure.core.implementation.annotation.Get; +import com.azure.core.implementation.annotation.HeaderParam; +import com.azure.core.implementation.annotation.Host; +import com.azure.core.implementation.annotation.HostParam; +import com.azure.core.implementation.annotation.Post; +import com.azure.core.implementation.annotation.Put; +import com.azure.core.implementation.annotation.QueryParam; +import com.azure.core.implementation.annotation.ReturnType; +import com.azure.core.implementation.annotation.ServiceInterface; +import com.azure.core.implementation.annotation.ServiceMethod; +import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType; import com.azure.core.util.Context; import com.azure.storage.blob.models.KeyInfo; import com.azure.storage.blob.models.ListContainersIncludeType; @@ -50,43 +52,43 @@ public final class ServicesImpl { * @param client the instance of the service client containing this operation class. */ public ServicesImpl(AzureBlobStorageImpl client) { - this.service = RestProxy.create(ServicesService.class, client); + this.service = RestProxy.create(ServicesService.class, client.getHttpPipeline()); this.client = client; } /** - * The interface defining all the services for Services to be used by the - * proxy service to perform REST calls. + * The interface defining all the services for AzureBlobStorageServices to + * be used by the proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Blobs Service") + @ServiceInterface(name = "AzureBlobStorageServices") private interface ServicesService { - @PUT("") + @Put("") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono setProperties(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") StorageServiceProperties storageServiceProperties, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); - @GET("") + @Get("") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getProperties(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); - @GET("") + @Get("") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getStatistics(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); - @GET("") + @Get("") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono listContainersSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") ListContainersIncludeType include, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); - @POST("") + @Post("") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getUserDelegationKey(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") KeyInfo keyInfo, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); - @GET("") + @Get("") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) Mono getAccountInfo(@HostParam("url") String url, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @@ -100,12 +102,13 @@ private interface ServicesService { * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono setPropertiesWithRestResponseAsync(StorageServiceProperties storageServiceProperties, Context context) { final Integer timeout = null; final String requestId = null; final String restype = "service"; final String comp = "properties"; - return service.setProperties(this.client.url(), storageServiceProperties, timeout, this.client.version(), requestId, restype, comp, context); + return service.setProperties(this.client.getUrl(), storageServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -118,10 +121,11 @@ public Mono setPropertiesWithRestResponseAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono setPropertiesWithRestResponseAsync(StorageServiceProperties storageServiceProperties, Integer timeout, String requestId, Context context) { final String restype = "service"; final String comp = "properties"; - return service.setProperties(this.client.url(), storageServiceProperties, timeout, this.client.version(), requestId, restype, comp, context); + return service.setProperties(this.client.getUrl(), storageServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -131,12 +135,13 @@ public Mono setPropertiesWithRestResponseAsync(St * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesWithRestResponseAsync(Context context) { final Integer timeout = null; final String requestId = null; final String restype = "service"; final String comp = "properties"; - return service.getProperties(this.client.url(), timeout, this.client.version(), requestId, restype, comp, context); + return service.getProperties(this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -148,10 +153,11 @@ public Mono getPropertiesWithRestResponseAsync(Co * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPropertiesWithRestResponseAsync(Integer timeout, String requestId, Context context) { final String restype = "service"; final String comp = "properties"; - return service.getProperties(this.client.url(), timeout, this.client.version(), requestId, restype, comp, context); + return service.getProperties(this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -161,12 +167,13 @@ public Mono getPropertiesWithRestResponseAsync(In * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getStatisticsWithRestResponseAsync(Context context) { final Integer timeout = null; final String requestId = null; final String restype = "service"; final String comp = "stats"; - return service.getStatistics(this.client.url(), timeout, this.client.version(), requestId, restype, comp, context); + return service.getStatistics(this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -178,10 +185,11 @@ public Mono getStatisticsWithRestResponseAsync(Co * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getStatisticsWithRestResponseAsync(Integer timeout, String requestId, Context context) { final String restype = "service"; final String comp = "stats"; - return service.getStatistics(this.client.url(), timeout, this.client.version(), requestId, restype, comp, context); + return service.getStatistics(this.client.getUrl(), timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -191,6 +199,7 @@ public Mono getStatisticsWithRestResponseAsync(In * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono listContainersSegmentWithRestResponseAsync(Context context) { final String prefix = null; final String marker = null; @@ -199,7 +208,7 @@ public Mono listContainersSegmentWithRest final Integer timeout = null; final String requestId = null; final String comp = "list"; - return service.listContainersSegment(this.client.url(), prefix, marker, maxresults, include, timeout, this.client.version(), requestId, comp, context); + return service.listContainersSegment(this.client.getUrl(), prefix, marker, maxresults, include, timeout, this.client.getVersion(), requestId, comp, context); } /** @@ -215,9 +224,10 @@ public Mono listContainersSegmentWithRest * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono listContainersSegmentWithRestResponseAsync(String prefix, String marker, Integer maxresults, ListContainersIncludeType include, Integer timeout, String requestId, Context context) { final String comp = "list"; - return service.listContainersSegment(this.client.url(), prefix, marker, maxresults, include, timeout, this.client.version(), requestId, comp, context); + return service.listContainersSegment(this.client.getUrl(), prefix, marker, maxresults, include, timeout, this.client.getVersion(), requestId, comp, context); } /** @@ -228,12 +238,13 @@ public Mono listContainersSegmentWithRest * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getUserDelegationKeyWithRestResponseAsync(KeyInfo keyInfo, Context context) { final Integer timeout = null; final String requestId = null; final String restype = "service"; final String comp = "userdelegationkey"; - return service.getUserDelegationKey(this.client.url(), keyInfo, timeout, this.client.version(), requestId, restype, comp, context); + return service.getUserDelegationKey(this.client.getUrl(), keyInfo, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -246,10 +257,11 @@ public Mono getUserDelegationKeyWithRestRe * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getUserDelegationKeyWithRestResponseAsync(KeyInfo keyInfo, Integer timeout, String requestId, Context context) { final String restype = "service"; final String comp = "userdelegationkey"; - return service.getUserDelegationKey(this.client.url(), keyInfo, timeout, this.client.version(), requestId, restype, comp, context); + return service.getUserDelegationKey(this.client.getUrl(), keyInfo, timeout, this.client.getVersion(), requestId, restype, comp, context); } /** @@ -259,9 +271,10 @@ public Mono getUserDelegationKeyWithRestRe * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ + @ServiceMethod(returns = ReturnType.SINGLE) public Mono getAccountInfoWithRestResponseAsync(Context context) { final String restype = "account"; final String comp = "properties"; - return service.getAccountInfo(this.client.url(), this.client.version(), restype, comp, context); + return service.getAccountInfo(this.client.getUrl(), this.client.getVersion(), restype, comp, context); } } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifiersWrapper.java b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifierWrapper.java similarity index 67% rename from storage/client/blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifiersWrapper.java rename to storage/client/blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifierWrapper.java index 41bac045975b2..8ad4982f32207 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifiersWrapper.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/SignedIdentifierWrapper.java @@ -14,19 +14,19 @@ /** * A wrapper around List<SignedIdentifier> which provides top-level metadata for serialization. */ -@JacksonXmlRootElement(localName = "SignedIdentifiers") -public final class SignedIdentifiersWrapper { +@JacksonXmlRootElement(localName = "SignedIdentifier") +public final class SignedIdentifierWrapper { @JacksonXmlProperty(localName = "SignedIdentifier") - private final List signedIdentifiers; + private final List signedIdentifier; /** - * Creates an instance of SignedIdentifiersWrapper. + * Creates an instance of SignedIdentifierWrapper. * - * @param signedIdentifiers the list. + * @param signedIdentifier the list. */ @JsonCreator - public SignedIdentifiersWrapper(@JsonProperty("SignedIdentifiers") List signedIdentifiers) { - this.signedIdentifiers = signedIdentifiers; + public SignedIdentifierWrapper(@JsonProperty("SignedIdentifier") List signedIdentifier) { + this.signedIdentifier = signedIdentifier; } /** @@ -35,6 +35,6 @@ public SignedIdentifiersWrapper(@JsonProperty("SignedIdentifiers") List items() { - return signedIdentifiers; + return signedIdentifier; } } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/package-info.java b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/package-info.java index 5f341b8ad1be0..dcf10679cc979 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/package-info.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/implementation/package-info.java @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * This package contains the implementations and inner classes for + * Package containing the implementations and inner classes for * AzureBlobStorage. */ package com.azure.storage.blob.implementation; diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AccessPolicy.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/AccessPolicy.java index 8b33f24bf5714..04ded069ff534 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AccessPolicy.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/AccessPolicy.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -12,6 +13,7 @@ * An Access policy. */ @JacksonXmlRootElement(localName = "AccessPolicy") +@Fluent public final class AccessPolicy { /* * the date-time the policy is active diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java index 8273338cb6676..8dcea49cd76c6 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.azure.core.implementation.util.ImplUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -14,6 +15,7 @@ * Defines headers for AppendBlockFromUrl operation. */ @JacksonXmlRootElement(localName = "AppendBlob-AppendBlockFromUrl-Headers") +@Fluent public final class AppendBlobAppendBlockFromUrlHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java index 8fe788378e589..a12cefa924e68 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.azure.core.implementation.util.ImplUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -14,6 +15,7 @@ * Defines headers for AppendBlock operation. */ @JacksonXmlRootElement(localName = "AppendBlob-AppendBlock-Headers") +@Fluent public final class AppendBlobAppendBlockHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobCreateHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobCreateHeaders.java index 45fd447bde387..c2e5a3e0929ed 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobCreateHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendBlobCreateHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.azure.core.implementation.util.ImplUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -14,6 +15,7 @@ * Defines headers for Create operation. */ @JacksonXmlRootElement(localName = "AppendBlob-Create-Headers") +@Fluent public final class AppendBlobCreateHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendPositionAccessConditions.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendPositionAccessConditions.java index 5894e08f86e36..e63fabf516af6 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendPositionAccessConditions.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/AppendPositionAccessConditions.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -12,6 +13,7 @@ * AppendBlobs_appendBlock, AppendBlobs_appendBlockFromUrl. */ @JacksonXmlRootElement(localName = "append-position-access-conditions") +@Fluent public final class AppendPositionAccessConditions { /* * Optional conditional header. The max length in bytes permitted for the diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java index e439f5b8b0892..c27f9fcac790f 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for AbortCopyFromURL operation. */ @JacksonXmlRootElement(localName = "Blob-AbortCopyFromURL-Headers") +@Fluent public final class BlobAbortCopyFromURLHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobAcquireLeaseHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobAcquireLeaseHeaders.java index 5bf6ef2560117..d4649062bc60c 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobAcquireLeaseHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobAcquireLeaseHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for AcquireLease operation. */ @JacksonXmlRootElement(localName = "Blob-AcquireLease-Headers") +@Fluent public final class BlobAcquireLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobBreakLeaseHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobBreakLeaseHeaders.java index b136802ce69ad..504b7201befe6 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobBreakLeaseHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobBreakLeaseHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for BreakLease operation. */ @JacksonXmlRootElement(localName = "Blob-BreakLease-Headers") +@Fluent public final class BlobBreakLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobChangeLeaseHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobChangeLeaseHeaders.java index 1c3010861eaf0..67d6971d9ff32 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobChangeLeaseHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobChangeLeaseHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for ChangeLease operation. */ @JacksonXmlRootElement(localName = "Blob-ChangeLease-Headers") +@Fluent public final class BlobChangeLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobCopyFromURLHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobCopyFromURLHeaders.java index 2568e1c566bcf..140b771f8cd64 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobCopyFromURLHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobCopyFromURLHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for CopyFromURL operation. */ @JacksonXmlRootElement(localName = "Blob-CopyFromURL-Headers") +@Fluent public final class BlobCopyFromURLHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobCreateSnapshotHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobCreateSnapshotHeaders.java index f185a465e483e..e27c4fde4964a 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobCreateSnapshotHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobCreateSnapshotHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for CreateSnapshot operation. */ @JacksonXmlRootElement(localName = "Blob-CreateSnapshot-Headers") +@Fluent public final class BlobCreateSnapshotHeaders { /* * Uniquely identifies the snapshot and indicates the snapshot version. It diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobDeleteHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobDeleteHeaders.java index 7aeac53bc5a33..95e6289c3e40b 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobDeleteHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobDeleteHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for Delete operation. */ @JacksonXmlRootElement(localName = "Blob-Delete-Headers") +@Fluent public final class BlobDeleteHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java index aa56c2e6683c4..4e9e2997ebab0 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java @@ -4,8 +4,9 @@ package com.azure.storage.blob.models; -import com.azure.core.annotations.HeaderCollection; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.azure.core.implementation.annotation.HeaderCollection; import com.azure.core.implementation.util.ImplUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -16,6 +17,7 @@ * Defines headers for Download operation. */ @JacksonXmlRootElement(localName = "Blob-Download-Headers") +@Fluent public final class BlobDownloadHeaders { /* * Returns the date and time the container was last modified. Any operation diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobFlatListSegment.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobFlatListSegment.java index 97f8e48a9c832..ac1f703d1cd7c 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobFlatListSegment.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobFlatListSegment.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.util.ArrayList; @@ -13,6 +14,7 @@ * The BlobFlatListSegment model. */ @JacksonXmlRootElement(localName = "Blobs") +@Fluent public final class BlobFlatListSegment { /* * The blobItems property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobGetAccountInfoHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobGetAccountInfoHeaders.java index 81c8b54b46615..21243aaac7325 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobGetAccountInfoHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobGetAccountInfoHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for GetAccountInfo operation. */ @JacksonXmlRootElement(localName = "Blob-GetAccountInfo-Headers") +@Fluent public final class BlobGetAccountInfoHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobGetPropertiesHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobGetPropertiesHeaders.java index cb1d9e3ba1762..728ae5fd9e1e2 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobGetPropertiesHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobGetPropertiesHeaders.java @@ -4,8 +4,9 @@ package com.azure.storage.blob.models; -import com.azure.core.annotations.HeaderCollection; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.azure.core.implementation.annotation.HeaderCollection; import com.azure.core.implementation.util.ImplUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -16,6 +17,7 @@ * Defines headers for GetProperties operation. */ @JacksonXmlRootElement(localName = "Blob-GetProperties-Headers") +@Fluent public final class BlobGetPropertiesHeaders { /* * Returns the date and time the blob was last modified. Any operation that diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobHTTPHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobHTTPHeaders.java index aafbd1eb56e5e..f25f4e566e6b8 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobHTTPHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobHTTPHeaders.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.azure.core.implementation.util.ImplUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -12,6 +13,7 @@ * Additional parameters for a set of operations. */ @JacksonXmlRootElement(localName = "blob-HTTP-headers") +@Fluent public final class BlobHTTPHeaders { /* * Optional. Sets the blob's cache control. If specified, this property is diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java index a70c2d2122f04..d90e89ab602f3 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java @@ -4,8 +4,8 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.util.ArrayList; import java.util.List; @@ -14,7 +14,7 @@ * The BlobHierarchyListSegment model. */ @JacksonXmlRootElement(localName = "Blobs") -@JsonDeserialize(using = CustomHierarchicalListingDeserializer.class) +@Fluent public final class BlobHierarchyListSegment { /* * The blobPrefixes property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobItem.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobItem.java index eb73dd3366b67..3d777a4b2e386 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobItem.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobItem.java @@ -4,15 +4,16 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - import java.util.Map; /** * An Azure Storage blob. */ @JacksonXmlRootElement(localName = "Blob") +@Fluent public final class BlobItem { /* * The name property. @@ -50,7 +51,11 @@ public final class BlobItem { @JsonProperty(value = "Metadata") private Map metadata; - private boolean isPrefix = false; + /* + * The isPrefix property. + */ + @JsonProperty(value = "IsPrefix") + private Boolean isPrefix; /** * Get the name property: The name property. @@ -173,18 +178,21 @@ public BlobItem metadata(Map metadata) { } /** - * @return if the blob item is a prefix instead of an actual blob. + * Get the isPrefix property: The isPrefix property. + * + * @return the isPrefix value. */ - public boolean isPrefix() { - return isPrefix; + public Boolean isPrefix() { + return this.isPrefix; } /** - * Sets if the blob item is a prefix instead of an actual blob - * @param isPrefix if the item is a prefix - * @return the BlobItem object itself + * Set the isPrefix property: The isPrefix property. + * + * @param isPrefix the isPrefix value to set. + * @return the BlobItem object itself. */ - public BlobItem isPrefix(boolean isPrefix) { + public BlobItem isPrefix(Boolean isPrefix) { this.isPrefix = isPrefix; return this; } diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobMetadata.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobMetadata.java index 5753ff479dbfb..30eed457954bb 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobMetadata.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobMetadata.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -13,6 +14,7 @@ * The BlobMetadata model. */ @JacksonXmlRootElement(localName = "Metadata") +@Fluent public final class BlobMetadata { /* * Unmatched properties from the message are deserialized this collection diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobPrefix.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobPrefix.java index 6507aaecfd380..55afd0bc25491 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobPrefix.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobPrefix.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * The BlobPrefix model. */ @JacksonXmlRootElement(localName = "BlobPrefix") +@Fluent public final class BlobPrefix { /* * The name property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobProperties.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobProperties.java index a297fe40e0432..d5bad7b9996e5 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobProperties.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobProperties.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.azure.core.implementation.util.ImplUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -14,6 +15,7 @@ * Properties of a blob. */ @JacksonXmlRootElement(localName = "Properties") +@Fluent public final class BlobProperties { /* * The creationTime property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobReleaseLeaseHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobReleaseLeaseHeaders.java index 661e9a24db979..f503b9ab6d309 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobReleaseLeaseHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobReleaseLeaseHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for ReleaseLease operation. */ @JacksonXmlRootElement(localName = "Blob-ReleaseLease-Headers") +@Fluent public final class BlobReleaseLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobRenewLeaseHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobRenewLeaseHeaders.java index 2ee66b3adb36b..863157cf8a427 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobRenewLeaseHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobRenewLeaseHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for RenewLease operation. */ @JacksonXmlRootElement(localName = "Blob-RenewLease-Headers") +@Fluent public final class BlobRenewLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java index 09111d5ae3e17..ed539d644bc1a 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for SetHTTPHeaders operation. */ @JacksonXmlRootElement(localName = "Blob-SetHTTPHeaders-Headers") +@Fluent public final class BlobSetHTTPHeadersHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobSetMetadataHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobSetMetadataHeaders.java index b831d8446cd1a..5b3898194287e 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobSetMetadataHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobSetMetadataHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for SetMetadata operation. */ @JacksonXmlRootElement(localName = "Blob-SetMetadata-Headers") +@Fluent public final class BlobSetMetadataHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobSetTierHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobSetTierHeaders.java index d2dd04c235a76..372b1a09ebc00 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobSetTierHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobSetTierHeaders.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * Defines headers for SetTier operation. */ @JacksonXmlRootElement(localName = "Blob-SetTier-Headers") +@Fluent public final class BlobSetTierHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java index c0059d598cceb..a6b195a6e6dcc 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for StartCopyFromURL operation. */ @JacksonXmlRootElement(localName = "Blob-StartCopyFromURL-Headers") +@Fluent public final class BlobStartCopyFromURLHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobUndeleteHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobUndeleteHeaders.java index 3123885e3af1f..cd1ea6a55d13d 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobUndeleteHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlobUndeleteHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for Undelete operation. */ @JacksonXmlRootElement(localName = "Blob-Undelete-Headers") +@Fluent public final class BlobUndeleteHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/Block.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/Block.java index 8fbfcaa8a7abe..5cfa164c8c854 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/Block.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/Block.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -12,6 +13,7 @@ * size. */ @JacksonXmlRootElement(localName = "Block") +@Fluent public final class Block { /* * The base64 encoded block ID. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java index a2605e19cf430..6bec949d71804 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.azure.core.implementation.util.ImplUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -14,6 +15,7 @@ * Defines headers for CommitBlockList operation. */ @JacksonXmlRootElement(localName = "BlockBlob-CommitBlockList-Headers") +@Fluent public final class BlockBlobCommitBlockListHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java index 26d77f85abadf..fa50d846ebefa 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for GetBlockList operation. */ @JacksonXmlRootElement(localName = "BlockBlob-GetBlockList-Headers") +@Fluent public final class BlockBlobGetBlockListHeaders { /* * Returns the date and time the container was last modified. Any operation diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java index 1b434c919342f..88dd3c6346edd 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.azure.core.implementation.util.ImplUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -14,6 +15,7 @@ * Defines headers for StageBlockFromURL operation. */ @JacksonXmlRootElement(localName = "BlockBlob-StageBlockFromURL-Headers") +@Fluent public final class BlockBlobStageBlockFromURLHeaders { /* * If the blob has an MD5 hash and this operation is to read the full blob, diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockHeaders.java index 40108ad24ec2a..56ffdfe937001 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.azure.core.implementation.util.ImplUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -14,6 +15,7 @@ * Defines headers for StageBlock operation. */ @JacksonXmlRootElement(localName = "BlockBlob-StageBlock-Headers") +@Fluent public final class BlockBlobStageBlockHeaders { /* * If the blob has an MD5 hash and this operation is to read the full blob, diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobUploadHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobUploadHeaders.java index e5430e100e6ea..76c59b2f74d94 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobUploadHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockBlobUploadHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.azure.core.implementation.util.ImplUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -14,6 +15,7 @@ * Defines headers for Upload operation. */ @JacksonXmlRootElement(localName = "BlockBlob-Upload-Headers") +@Fluent public final class BlockBlobUploadHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockList.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockList.java index 70a0fb8d312ef..dfa4deadeb89c 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockList.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockList.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; @@ -15,6 +16,7 @@ * The BlockList model. */ @JacksonXmlRootElement(localName = "BlockList") +@Fluent public final class BlockList { private static final class CommittedBlocksWrapper { @JacksonXmlProperty(localName = "Block") diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockLookupList.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockLookupList.java index 9cc63338a8996..40bb5d346e004 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockLookupList.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/BlockLookupList.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.util.ArrayList; @@ -13,6 +14,7 @@ * The BlockLookupList model. */ @JacksonXmlRootElement(localName = "BlockList") +@Fluent public final class BlockLookupList { /* * The committed property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ClearRange.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ClearRange.java index cb8d7a208ab3a..e607faf87b058 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ClearRange.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ClearRange.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * The ClearRange model. */ @JacksonXmlRootElement(localName = "ClearRange") +@Fluent public final class ClearRange { /* * The start property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java index 0ba172f04e33a..bd6d0580bdcfb 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for AcquireLease operation. */ @JacksonXmlRootElement(localName = "Container-AcquireLease-Headers") +@Fluent public final class ContainerAcquireLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerBreakLeaseHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerBreakLeaseHeaders.java index 98a1106ccc6ef..4df2a5f3ddef2 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerBreakLeaseHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerBreakLeaseHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for BreakLease operation. */ @JacksonXmlRootElement(localName = "Container-BreakLease-Headers") +@Fluent public final class ContainerBreakLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerChangeLeaseHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerChangeLeaseHeaders.java index 880214fc46b52..8c5371a5121f7 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerChangeLeaseHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerChangeLeaseHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for ChangeLease operation. */ @JacksonXmlRootElement(localName = "Container-ChangeLease-Headers") +@Fluent public final class ContainerChangeLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerCreateHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerCreateHeaders.java index 280734c615016..9a22e560ca72c 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerCreateHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerCreateHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for Create operation. */ @JacksonXmlRootElement(localName = "Container-Create-Headers") +@Fluent public final class ContainerCreateHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerDeleteHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerDeleteHeaders.java index 52f2623a635d5..64af976e03679 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerDeleteHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerDeleteHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for Delete operation. */ @JacksonXmlRootElement(localName = "Container-Delete-Headers") +@Fluent public final class ContainerDeleteHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java index 4905b3c2949fe..a1a76b2f57ba5 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for GetAccessPolicy operation. */ @JacksonXmlRootElement(localName = "Container-GetAccessPolicy-Headers") +@Fluent public final class ContainerGetAccessPolicyHeaders { /* * Indicated whether data in the container may be accessed publicly and the diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java index c82baa2c1a6b7..692c4a71fc522 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for GetAccountInfo operation. */ @JacksonXmlRootElement(localName = "Container-GetAccountInfo-Headers") +@Fluent public final class ContainerGetAccountInfoHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerGetPropertiesHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerGetPropertiesHeaders.java index b37286c1b7af3..df2d12bbcdb6e 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerGetPropertiesHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerGetPropertiesHeaders.java @@ -4,8 +4,9 @@ package com.azure.storage.blob.models; -import com.azure.core.annotations.HeaderCollection; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; +import com.azure.core.implementation.annotation.HeaderCollection; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -15,6 +16,7 @@ * Defines headers for GetProperties operation. */ @JacksonXmlRootElement(localName = "Container-GetProperties-Headers") +@Fluent public final class ContainerGetPropertiesHeaders { /* * The metadata property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerItem.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerItem.java index a334568661eb1..543085f349c81 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerItem.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerItem.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.util.Map; @@ -12,6 +13,7 @@ * An Azure Storage container. */ @JacksonXmlRootElement(localName = "Container") +@Fluent public final class ContainerItem { /* * The name property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java index 311c0c6ca66bf..ef1252a5a8d4c 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for ListBlobFlatSegment operation. */ @JacksonXmlRootElement(localName = "Container-ListBlobFlatSegment-Headers") +@Fluent public final class ContainerListBlobFlatSegmentHeaders { /* * The media type of the body of the response. For List Blobs this is diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java index 7456e14d89809..d1a671cf75501 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for ListBlobHierarchySegment operation. */ @JacksonXmlRootElement(localName = "Container-ListBlobHierarchySegment-Headers") +@Fluent public final class ContainerListBlobHierarchySegmentHeaders { /* * The media type of the body of the response. For List Blobs this is diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerProperties.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerProperties.java index b4844ac52dcfb..f159a57f2cd5c 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerProperties.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerProperties.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Properties of a container. */ @JacksonXmlRootElement(localName = "ContainerProperties") +@Fluent public final class ContainerProperties { /* * The lastModified property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java index b437d814e16ca..7a8766ab2424b 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for ReleaseLease operation. */ @JacksonXmlRootElement(localName = "Container-ReleaseLease-Headers") +@Fluent public final class ContainerReleaseLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerRenewLeaseHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerRenewLeaseHeaders.java index e9a03210ae1a3..a192e95a96c8e 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerRenewLeaseHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerRenewLeaseHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for RenewLease operation. */ @JacksonXmlRootElement(localName = "Container-RenewLease-Headers") +@Fluent public final class ContainerRenewLeaseHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java index a91ceed6d34d1..763e752918002 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for SetAccessPolicy operation. */ @JacksonXmlRootElement(localName = "Container-SetAccessPolicy-Headers") +@Fluent public final class ContainerSetAccessPolicyHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerSetMetadataHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerSetMetadataHeaders.java index 082886b7c0b54..e685322b83ffa 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerSetMetadataHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ContainerSetMetadataHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for SetMetadata operation. */ @JacksonXmlRootElement(localName = "Container-SetMetadata-Headers") +@Fluent public final class ContainerSetMetadataHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/CorsRule.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/CorsRule.java index fa9035b072c6c..e111fbb62e308 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/CorsRule.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/CorsRule.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -15,6 +16,7 @@ * one domain (the origin domain) to call APIs in another domain. */ @JacksonXmlRootElement(localName = "CorsRule") +@Fluent public final class CorsRule { /* * The origin domains that are permitted to make a request against the diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/GeoReplication.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/GeoReplication.java index 90cf41b12f07f..d583130cc13a9 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/GeoReplication.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/GeoReplication.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Geo-Replication information for the Secondary Storage Service. */ @JacksonXmlRootElement(localName = "GeoReplication") +@Fluent public final class GeoReplication { /* * The status of the secondary location. Possible values include: 'live', diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/KeyInfo.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/KeyInfo.java index d1aa23bbcef7c..6c742e4ed7860 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/KeyInfo.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/KeyInfo.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * Key information. */ @JacksonXmlRootElement(localName = "KeyInfo") +@Fluent public final class KeyInfo { /* * The date-time the key is active in ISO 8601 UTC time diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/LeaseAccessConditions.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/LeaseAccessConditions.java index eae367a636e25..9a43064e549f5 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/LeaseAccessConditions.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/LeaseAccessConditions.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * Additional parameters for a set of operations. */ @JacksonXmlRootElement(localName = "lease-access-conditions") +@Fluent public final class LeaseAccessConditions { /* * If specified, the operation only succeeds if the resource's lease is diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java index 1807bc8efe364..593688ccc3e11 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -12,6 +13,7 @@ * An enumeration of blobs. */ @JacksonXmlRootElement(localName = "EnumerationResults") +@Fluent public final class ListBlobsFlatSegmentResponse { /* * The serviceEndpoint property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java index f79c285a10796..51aee28565674 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -12,6 +13,7 @@ * An enumeration of blobs. */ @JacksonXmlRootElement(localName = "EnumerationResults") +@Fluent public final class ListBlobsHierarchySegmentResponse { /* * The serviceEndpoint property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersSegmentResponse.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersSegmentResponse.java index deafc07a94435..97f342484a8fc 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersSegmentResponse.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ListContainersSegmentResponse.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; @@ -15,6 +16,7 @@ * An enumeration of containers. */ @JacksonXmlRootElement(localName = "EnumerationResults") +@Fluent public final class ListContainersSegmentResponse { /* * The serviceEndpoint property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/Logging.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/Logging.java index e86ad32a0ae74..9aa3f4cce40b3 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/Logging.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/Logging.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * Azure Analytics Logging settings. */ @JacksonXmlRootElement(localName = "Logging") +@Fluent public final class Logging { /* * The version of Storage Analytics to configure. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/Metrics.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/Metrics.java index c812d6a86a533..ee8ad19b28563 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/Metrics.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/Metrics.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -12,6 +13,7 @@ * for blobs. */ @JacksonXmlRootElement(localName = "Metrics") +@Fluent public final class Metrics { /* * The version of Storage Analytics to configure. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ModifiedAccessConditions.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ModifiedAccessConditions.java index 3636dfd4c290c..01e9de89ae16a 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ModifiedAccessConditions.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ModifiedAccessConditions.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Additional parameters for a set of operations. */ @JacksonXmlRootElement(localName = "modified-access-conditions") +@Fluent public final class ModifiedAccessConditions { /* * Specify this header value to operate only on a blob if it has been diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java index 45f30cefd53a1..543c829bf2718 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.azure.core.implementation.util.ImplUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -14,6 +15,7 @@ * Defines headers for ClearPages operation. */ @JacksonXmlRootElement(localName = "PageBlob-ClearPages-Headers") +@Fluent public final class PageBlobClearPagesHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java index 3a1ea5cd5f9d7..7e9aa95c1ff37 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for CopyIncremental operation. */ @JacksonXmlRootElement(localName = "PageBlob-CopyIncremental-Headers") +@Fluent public final class PageBlobCopyIncrementalHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobCreateHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobCreateHeaders.java index 215c6f4c934aa..6c4192fe4806d 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobCreateHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobCreateHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.azure.core.implementation.util.ImplUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -14,6 +15,7 @@ * Defines headers for Create operation. */ @JacksonXmlRootElement(localName = "PageBlob-Create-Headers") +@Fluent public final class PageBlobCreateHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java index 5f75cf82af768..c1d14635bf44f 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for GetPageRangesDiff operation. */ @JacksonXmlRootElement(localName = "PageBlob-GetPageRangesDiff-Headers") +@Fluent public final class PageBlobGetPageRangesDiffHeaders { /* * Returns the date and time the container was last modified. Any operation diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java index a9004d8dd2c91..32b37ef1452c0 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for GetPageRanges operation. */ @JacksonXmlRootElement(localName = "PageBlob-GetPageRanges-Headers") +@Fluent public final class PageBlobGetPageRangesHeaders { /* * Returns the date and time the container was last modified. Any operation diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobResizeHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobResizeHeaders.java index f9396b66835c3..e03c8720d2b67 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobResizeHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobResizeHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for Resize operation. */ @JacksonXmlRootElement(localName = "PageBlob-Resize-Headers") +@Fluent public final class PageBlobResizeHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java index 317c57bb35cea..5f606b24c2622 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for UpdateSequenceNumber operation. */ @JacksonXmlRootElement(localName = "PageBlob-UpdateSequenceNumber-Headers") +@Fluent public final class PageBlobUpdateSequenceNumberHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java index ad21b582b509e..cebeb20842e37 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.azure.core.implementation.util.ImplUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -14,6 +15,7 @@ * Defines headers for UploadPagesFromURL operation. */ @JacksonXmlRootElement(localName = "PageBlob-UploadPagesFromURL-Headers") +@Fluent public final class PageBlobUploadPagesFromURLHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesHeaders.java index 29cf41bae0b8e..7dd8eb12ae720 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.azure.core.implementation.util.ImplUtils; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -14,6 +15,7 @@ * Defines headers for UploadPages operation. */ @JacksonXmlRootElement(localName = "PageBlob-UploadPages-Headers") +@Fluent public final class PageBlobUploadPagesHeaders { /* * The ETag contains a value that you can use to perform operations diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageList.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageList.java index cf921ab92646b..b981bdf2f6edb 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageList.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageList.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.util.ArrayList; @@ -13,6 +14,7 @@ * the list of pages. */ @JacksonXmlRootElement(localName = "PageList") +@Fluent public final class PageList { /* * The pageRange property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageRange.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageRange.java index 5ce78ebfb0db8..53a76779cd4d4 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageRange.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/PageRange.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * The PageRange model. */ @JacksonXmlRootElement(localName = "PageRange") +@Fluent public final class PageRange { /* * The start property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/RetentionPolicy.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/RetentionPolicy.java index d6285c64af18f..7877f6dd0bd76 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/RetentionPolicy.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/RetentionPolicy.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -12,6 +13,7 @@ * persist. */ @JacksonXmlRootElement(localName = "RetentionPolicy") +@Fluent public final class RetentionPolicy { /* * Indicates whether a retention policy is enabled for the storage service diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/SequenceNumberAccessConditions.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/SequenceNumberAccessConditions.java index df0399ff59123..c211020aeb245 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/SequenceNumberAccessConditions.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/SequenceNumberAccessConditions.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -12,6 +13,7 @@ * PageBlobs_uploadPages, PageBlobs_clearPages, PageBlobs_uploadPagesFromURL. */ @JacksonXmlRootElement(localName = "sequence-number-access-conditions") +@Fluent public final class SequenceNumberAccessConditions { /* * Specify this header value to operate only on a blob if it has a sequence diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java index b0c6820cf0848..88fa50830518e 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for GetAccountInfo operation. */ @JacksonXmlRootElement(localName = "Service-GetAccountInfo-Headers") +@Fluent public final class ServiceGetAccountInfoHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetPropertiesHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetPropertiesHeaders.java index 3126a5153421e..3b5b06ab3259a 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetPropertiesHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetPropertiesHeaders.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * Defines headers for GetProperties operation. */ @JacksonXmlRootElement(localName = "Service-GetProperties-Headers") +@Fluent public final class ServiceGetPropertiesHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetStatisticsHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetStatisticsHeaders.java index 34fcda3653a60..55dda9cc8ddb6 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetStatisticsHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetStatisticsHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for GetStatistics operation. */ @JacksonXmlRootElement(localName = "Service-GetStatistics-Headers") +@Fluent public final class ServiceGetStatisticsHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java index 9c685c2906102..4a74086587afa 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Defines headers for GetUserDelegationKey operation. */ @JacksonXmlRootElement(localName = "Service-GetUserDelegationKey-Headers") +@Fluent public final class ServiceGetUserDelegationKeyHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java index d22b9f1febc4f..94908506ede78 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * Defines headers for ListContainersSegment operation. */ @JacksonXmlRootElement(localName = "Service-ListContainersSegment-Headers") +@Fluent public final class ServiceListContainersSegmentHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceSetPropertiesHeaders.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceSetPropertiesHeaders.java index 065e595244fc3..df15cc7664002 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceSetPropertiesHeaders.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/ServiceSetPropertiesHeaders.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * Defines headers for SetProperties operation. */ @JacksonXmlRootElement(localName = "Service-SetProperties-Headers") +@Fluent public final class ServiceSetPropertiesHeaders { /* * This header uniquely identifies the request that was made and can be diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/SignedIdentifier.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/SignedIdentifier.java index 417f49492e51a..63e3aea5e584b 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/SignedIdentifier.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/SignedIdentifier.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * signed identifier. */ @JacksonXmlRootElement(localName = "SignedIdentifier") +@Fluent public final class SignedIdentifier { /* * a unique id diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/SourceModifiedAccessConditions.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/SourceModifiedAccessConditions.java index 84b179bb01812..9874a3b9557ed 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/SourceModifiedAccessConditions.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/SourceModifiedAccessConditions.java @@ -5,6 +5,7 @@ package com.azure.storage.blob.models; import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -13,6 +14,7 @@ * Additional parameters for a set of operations. */ @JacksonXmlRootElement(localName = "source-modified-access-conditions") +@Fluent public final class SourceModifiedAccessConditions { /* * Specify this header value to operate only on a blob if it has been diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/StaticWebsite.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/StaticWebsite.java index 45971febb06e2..91fffc8ba4bc8 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/StaticWebsite.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/StaticWebsite.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * The properties that enable an account to host a static website. */ @JacksonXmlRootElement(localName = "StaticWebsite") +@Fluent public final class StaticWebsite { /* * Indicates whether this account is hosting a static website diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageError.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageError.java index 55c96be21c801..2f8f01f4f6f9d 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageError.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageError.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * The StorageError model. */ @JacksonXmlRootElement(localName = "StorageError") +@Fluent public final class StorageError { /* * The code property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java index 79e072ba2b059..a83c072fcce9f 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; @@ -15,6 +16,7 @@ * Storage Service Properties. */ @JacksonXmlRootElement(localName = "StorageServiceProperties") +@Fluent public final class StorageServiceProperties { /* * The logging property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageServiceStats.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageServiceStats.java index 5eb67c3230645..04dd8dfc94dd6 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageServiceStats.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/StorageServiceStats.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; @@ -11,6 +12,7 @@ * Stats for the storage service. */ @JacksonXmlRootElement(localName = "StorageServiceStats") +@Fluent public final class StorageServiceStats { /* * The geoReplication property. diff --git a/storage/client/blob/src/main/java/com/azure/storage/blob/models/UserDelegationKey.java b/storage/client/blob/src/main/java/com/azure/storage/blob/models/UserDelegationKey.java index d267df92d7c29..7598fd90340d5 100644 --- a/storage/client/blob/src/main/java/com/azure/storage/blob/models/UserDelegationKey.java +++ b/storage/client/blob/src/main/java/com/azure/storage/blob/models/UserDelegationKey.java @@ -4,6 +4,7 @@ package com.azure.storage.blob.models; +import com.azure.core.implementation.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; import java.time.OffsetDateTime; @@ -12,6 +13,7 @@ * A user delegation key. */ @JacksonXmlRootElement(localName = "UserDelegationKey") +@Fluent public final class UserDelegationKey { /* * The Azure Active Directory object ID in GUID format. diff --git a/storage/client/blob/src/test/java/com/azure/storage/blob/APISpec.groovy b/storage/client/blob/src/test/java/com/azure/storage/blob/APISpec.groovy index fb306c17ff358..daf12f13fb8e1 100644 --- a/storage/client/blob/src/test/java/com/azure/storage/blob/APISpec.groovy +++ b/storage/client/blob/src/test/java/com/azure/storage/blob/APISpec.groovy @@ -3,9 +3,15 @@ package com.azure.storage.blob -import com.azure.core.http.* +import com.azure.core.http.HttpClient +import com.azure.core.http.HttpHeaders +import com.azure.core.http.HttpPipelineCallContext +import com.azure.core.http.HttpPipelineNextPolicy +import com.azure.core.http.HttpRequest +import com.azure.core.http.HttpResponse import com.azure.core.http.policy.HttpLogDetailLevel import com.azure.core.http.policy.HttpPipelinePolicy +import com.azure.core.http.ProxyOptions import com.azure.core.http.rest.Response import com.azure.core.util.configuration.ConfigurationManager import com.azure.identity.credential.EnvironmentCredential @@ -50,7 +56,7 @@ class APISpec extends Specification { static defaultDataSize = defaultData.remaining() // If debugging is enabled, recordings cannot run as there can only be one proxy at a time. - static boolean enableDebugging = false + static boolean enableDebugging = true // Prefixes for blobs and containers static String containerPrefix = "jtc" // java test container diff --git a/storage/client/blob/swagger/blob.json b/storage/client/blob/swagger/blob.json index 4a89d47458cc3..19d7f37b25a65 100644 --- a/storage/client/blob/swagger/blob.json +++ b/storage/client/blob/swagger/blob.json @@ -2405,15 +2405,6 @@ "format": "file" } }, - "304": { - "description": "The condition specified using HTTP conditional header(s) is not met.", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - } - }, "default": { "description": "Failure", "headers": { @@ -2706,15 +2697,6 @@ } } }, - "304": { - "description": "The condition specified using HTTP conditional header(s) is not met.", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - } - }, "default": { "description": "Failure", "headers": { @@ -5077,15 +5059,6 @@ } } }, - "304": { - "description": "The condition specified using HTTP conditional header(s) is not met.", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - } - }, "default": { "description": "Failure", "headers": { @@ -5791,15 +5764,6 @@ } } }, - "304": { - "description": "The condition specified using HTTP conditional header(s) is not met.", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - } - }, "default": { "description": "Failure", "headers": { @@ -5930,15 +5894,6 @@ "$ref": "#/definitions/PageList" } }, - "304": { - "description": "The condition specified using HTTP conditional header(s) is not met.", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - } - }, "default": { "description": "Failure", "headers": { @@ -6056,15 +6011,6 @@ "$ref": "#/definitions/PageList" } }, - "304": { - "description": "The condition specified using HTTP conditional header(s) is not met.", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - } - }, "default": { "description": "Failure", "headers": { @@ -6683,15 +6629,6 @@ } } }, - "304": { - "description": "The condition specified using HTTP conditional header(s) is not met.", - "headers": { - "x-ms-error-code": { - "x-ms-client-name": "ErrorCode", - "type": "string" - } - } - }, "default": { "description": "Failure", "headers": { @@ -6939,7 +6876,13 @@ "$ref": "#/definitions/BlobProperties" }, "Metadata": { - "$ref": "#/definitions/BlobMetadata" + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "IsPrefix": { + "type": "boolean" } } }, @@ -7767,7 +7710,7 @@ }, "xml": { "wrapped": true, - "name": "SignedIdentifiers" + "name": "SignedIdentifier" } }, "StaticWebsite": { @@ -7864,7 +7807,7 @@ "pattern": "^[a-zA-Z0-9]+(?:/[a-zA-Z0-9]+)*(?:\\.[a-zA-Z0-9]+){0,1}$", "minLength": 1, "maxLength": 1024, - "x-ms-parameter-location": "client", + "x-ms-parameter-location": "method", "description": "The blob name." }, "BlobCacheControl": { @@ -8119,7 +8062,7 @@ "in": "path", "required": true, "type": "string", - "x-ms-parameter-location": "client", + "x-ms-parameter-location": "method", "description": "The container name." }, "ContentCrc64": { diff --git a/storage/client/file/pom.xml b/storage/client/file/pom.xml index 5355d42110408..c9fe47848dcf1 100644 --- a/storage/client/file/pom.xml +++ b/storage/client/file/pom.xml @@ -35,7 +35,7 @@ com.azure azure-core - 1.0.0-preview.2 + 1.0.0-preview.3