Skip to content

Commit 36ff5e1

Browse files
authored
Cleanup Swagger Transforms and Customizations in Azure Storage (Azure#25773)
Cleanup Swagger Transforms and Customizations in Azure Storage
1 parent d68d7ca commit 36ff5e1

File tree

61 files changed

+833
-881
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+833
-881
lines changed

sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
import com.azure.storage.blob.implementation.models.AppendBlobsCreateResponse;
2626
import com.azure.storage.blob.implementation.models.AppendBlobsSealResponse;
2727
import com.azure.storage.blob.implementation.models.EncryptionScope;
28-
import com.azure.storage.blob.implementation.models.StorageErrorException;
2928
import com.azure.storage.blob.models.BlobHttpHeaders;
3029
import com.azure.storage.blob.models.BlobImmutabilityPolicyMode;
30+
import com.azure.storage.blob.models.BlobStorageException;
3131
import com.azure.storage.blob.models.CpkInfo;
3232
import com.azure.storage.blob.models.EncryptionAlgorithmType;
3333
import java.nio.ByteBuffer;
@@ -64,7 +64,7 @@ public final class AppendBlobsImpl {
6464
public interface AppendBlobsService {
6565
@Put("/{containerName}/{blob}")
6666
@ExpectedResponses({201})
67-
@UnexpectedResponseExceptionType(com.azure.storage.blob.models.BlobStorageException.class)
67+
@UnexpectedResponseExceptionType(BlobStorageException.class)
6868
Mono<AppendBlobsCreateResponse> create(
6969
@HostParam("url") String url,
7070
@PathParam("containerName") String containerName,
@@ -100,7 +100,7 @@ Mono<AppendBlobsCreateResponse> create(
100100

101101
@Put("/{containerName}/{blob}")
102102
@ExpectedResponses({201})
103-
@UnexpectedResponseExceptionType(com.azure.storage.blob.models.BlobStorageException.class)
103+
@UnexpectedResponseExceptionType(BlobStorageException.class)
104104
Mono<AppendBlobsAppendBlockResponse> appendBlock(
105105
@HostParam("url") String url,
106106
@PathParam("containerName") String containerName,
@@ -130,7 +130,7 @@ Mono<AppendBlobsAppendBlockResponse> appendBlock(
130130

131131
@Put("/{containerName}/{blob}")
132132
@ExpectedResponses({201})
133-
@UnexpectedResponseExceptionType(com.azure.storage.blob.models.BlobStorageException.class)
133+
@UnexpectedResponseExceptionType(BlobStorageException.class)
134134
Mono<AppendBlobsAppendBlockFromUrlResponse> appendBlockFromUrl(
135135
@HostParam("url") String url,
136136
@PathParam("containerName") String containerName,
@@ -167,7 +167,7 @@ Mono<AppendBlobsAppendBlockFromUrlResponse> appendBlockFromUrl(
167167

168168
@Put("/{containerName}/{blob}")
169169
@ExpectedResponses({200})
170-
@UnexpectedResponseExceptionType(com.azure.storage.blob.models.BlobStorageException.class)
170+
@UnexpectedResponseExceptionType(BlobStorageException.class)
171171
Mono<AppendBlobsSealResponse> seal(
172172
@HostParam("url") String url,
173173
@PathParam("containerName") String containerName,
@@ -220,7 +220,7 @@ Mono<AppendBlobsSealResponse> seal(
220220
* @param encryptionScopeParam Parameter group.
221221
* @param context The context to associate with this operation.
222222
* @throws IllegalArgumentException thrown if parameters fail the validation.
223-
* @throws StorageErrorException thrown if the request is rejected by server.
223+
* @throws BlobStorageException thrown if the request is rejected by server.
224224
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
225225
* @return the completion.
226226
*/
@@ -375,7 +375,7 @@ public Mono<AppendBlobsCreateResponse> createWithResponseAsync(
375375
* @param encryptionScopeParam Parameter group.
376376
* @param context The context to associate with this operation.
377377
* @throws IllegalArgumentException thrown if parameters fail the validation.
378-
* @throws StorageErrorException thrown if the request is rejected by server.
378+
* @throws BlobStorageException thrown if the request is rejected by server.
379379
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
380380
* @return the completion.
381381
*/
@@ -503,7 +503,7 @@ public Mono<AppendBlobsAppendBlockResponse> appendBlockWithResponseAsync(
503503
* @param encryptionScopeParam Parameter group.
504504
* @param context The context to associate with this operation.
505505
* @throws IllegalArgumentException thrown if parameters fail the validation.
506-
* @throws StorageErrorException thrown if the request is rejected by server.
506+
* @throws BlobStorageException thrown if the request is rejected by server.
507507
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
508508
* @return the completion.
509509
*/
@@ -627,7 +627,7 @@ public Mono<AppendBlobsAppendBlockFromUrlResponse> appendBlockFromUrlWithRespons
627627
* Precondition Failed).
628628
* @param context The context to associate with this operation.
629629
* @throws IllegalArgumentException thrown if parameters fail the validation.
630-
* @throws StorageErrorException thrown if the request is rejected by server.
630+
* @throws BlobStorageException thrown if the request is rejected by server.
631631
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
632632
* @return the completion.
633633
*/

sdk/storage/azure-storage-blob/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImplBuilder.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.azure.core.http.HttpHeaders;
1010
import com.azure.core.http.HttpPipeline;
1111
import com.azure.core.http.HttpPipelineBuilder;
12+
import com.azure.core.http.HttpPipelinePosition;
1213
import com.azure.core.http.policy.AddHeadersPolicy;
1314
import com.azure.core.http.policy.CookiePolicy;
1415
import com.azure.core.http.policy.HttpLogOptions;
@@ -26,6 +27,7 @@
2627
import java.util.HashMap;
2728
import java.util.List;
2829
import java.util.Map;
30+
import java.util.stream.Collectors;
2931

3032
/** A builder for creating a new instance of the AzureBlobStorage type. */
3133
@ServiceClientBuilder(serviceClients = {AzureBlobStorageImpl.class})
@@ -243,16 +245,24 @@ private HttpPipeline createHttpPipeline() {
243245
if (headers.getSize() > 0) {
244246
policies.add(new AddHeadersPolicy(headers));
245247
}
248+
policies.addAll(
249+
this.pipelinePolicies.stream()
250+
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
251+
.collect(Collectors.toList()));
246252
HttpPolicyProviders.addBeforeRetryPolicies(policies);
247253
policies.add(retryPolicy == null ? new RetryPolicy() : retryPolicy);
248254
policies.add(new CookiePolicy());
249-
policies.addAll(this.pipelinePolicies);
255+
policies.addAll(
256+
this.pipelinePolicies.stream()
257+
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
258+
.collect(Collectors.toList()));
250259
HttpPolicyProviders.addAfterRetryPolicies(policies);
251260
policies.add(new HttpLoggingPolicy(httpLogOptions));
252261
HttpPipeline httpPipeline =
253262
new HttpPipelineBuilder()
254263
.policies(policies.toArray(new HttpPipelinePolicy[0]))
255264
.httpClient(httpClient)
265+
.clientOptions(clientOptions)
256266
.build();
257267
return httpPipeline;
258268
}

0 commit comments

Comments
 (0)