Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

package com.azure.storage.blob;

import static com.azure.core.implementation.util.FluxUtil.withContext;
import static com.azure.storage.blob.implementation.PostProcessor.postProcessResponse;

import com.azure.core.annotation.ServiceClient;
import com.azure.core.credentials.TokenCredential;
import com.azure.core.http.HttpPipeline;
Expand All @@ -19,22 +16,26 @@
import com.azure.core.util.logging.ClientLogger;
import com.azure.storage.blob.implementation.AzureBlobStorageBuilder;
import com.azure.storage.blob.implementation.AzureBlobStorageImpl;
import com.azure.storage.blob.implementation.models.ServicesListContainersSegmentResponse;
import com.azure.storage.blob.implementation.models.ServicesListBlobContainersSegmentResponse;
import com.azure.storage.blob.models.BlobContainerItem;
import com.azure.storage.blob.models.BlobServiceProperties;
import com.azure.storage.blob.models.CpkInfo;
import com.azure.storage.blob.models.KeyInfo;
import com.azure.storage.blob.models.ListBlobContainersOptions;
import com.azure.storage.blob.models.PublicAccessType;
import com.azure.storage.blob.models.StorageAccountInfo;
import com.azure.storage.blob.models.StorageServiceProperties;
import com.azure.storage.blob.models.StorageServiceStats;
import com.azure.storage.blob.models.UserDelegationKey;
import com.azure.storage.common.Utility;
import reactor.core.publisher.Mono;

import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.Map;
import java.util.function.Function;
import reactor.core.publisher.Mono;

import static com.azure.core.implementation.util.FluxUtil.withContext;
import static com.azure.storage.blob.implementation.PostProcessor.postProcessResponse;

/**
* Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does
Expand Down Expand Up @@ -234,19 +235,19 @@ PagedFlux<BlobContainerItem> listBlobContainersWithOptionalTimeout(ListBlobConta
response.getRequest(),
response.getStatusCode(),
response.getHeaders(),
response.getValue().getContainerItems(),
response.getValue().getBlobContainerItems(),
response.getValue().getNextMarker(),
response.getDeserializedHeaders()));

return new PagedFlux<>(() -> func.apply(null), func);
}

private Mono<ServicesListContainersSegmentResponse> listBlobContainersSegment(String marker,
private Mono<ServicesListBlobContainersSegmentResponse> listBlobContainersSegment(String marker,
ListBlobContainersOptions options, Duration timeout) {
options = options == null ? new ListBlobContainersOptions() : options;

return postProcessResponse(Utility.applyOptionalTimeout(
this.azureBlobStorage.services().listContainersSegmentWithRestResponseAsync(
this.azureBlobStorage.services().listBlobContainersSegmentWithRestResponseAsync(
options.getPrefix(), marker, options.getMaxResults(), options.getDetails().toIncludeType(), null,
null, Context.NONE), timeout));
}
Expand All @@ -261,7 +262,7 @@ private Mono<ServicesListContainersSegmentResponse> listBlobContainersSegment(St
*
* @return A reactive response containing the storage account properties.
*/
public Mono<StorageServiceProperties> getProperties() {
public Mono<BlobServiceProperties> getProperties() {
return getPropertiesWithResponse().flatMap(FluxUtil::toMono);
}

Expand All @@ -276,11 +277,11 @@ public Mono<StorageServiceProperties> getProperties() {
* @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue() value} contains the storage
* account properties.
*/
public Mono<Response<StorageServiceProperties>> getPropertiesWithResponse() {
public Mono<Response<BlobServiceProperties>> getPropertiesWithResponse() {
return withContext(this::getPropertiesWithResponse);
}

Mono<Response<StorageServiceProperties>> getPropertiesWithResponse(Context context) {
Mono<Response<BlobServiceProperties>> getPropertiesWithResponse(Context context) {
return postProcessResponse(
this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, context))
.map(rb -> new SimpleResponse<>(rb, rb.getValue()));
Expand All @@ -299,7 +300,7 @@ Mono<Response<StorageServiceProperties>> getPropertiesWithResponse(Context conte
* @param properties Configures the service.
* @return A {@link Mono} containing the storage account properties.
*/
public Mono<Void> setProperties(StorageServiceProperties properties) {
public Mono<Void> setProperties(BlobServiceProperties properties) {
return setPropertiesWithResponse(properties).flatMap(FluxUtil::toMono);
}

Expand All @@ -315,11 +316,11 @@ public Mono<Void> setProperties(StorageServiceProperties properties) {
* @param properties Configures the service.
* @return A {@link Mono} containing the storage account properties.
*/
public Mono<Response<Void>> setPropertiesWithResponse(StorageServiceProperties properties) {
public Mono<Response<Void>> setPropertiesWithResponse(BlobServiceProperties properties) {
return withContext(context -> setPropertiesWithResponse(properties, context));
}

Mono<Response<Void>> setPropertiesWithResponse(StorageServiceProperties properties, Context context) {
Mono<Response<Void>> setPropertiesWithResponse(BlobServiceProperties properties, Context context) {
return postProcessResponse(
this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, context))
.map(response -> new SimpleResponse<>(response, null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@
import com.azure.core.http.rest.SimpleResponse;
import com.azure.core.util.Context;
import com.azure.storage.blob.models.BlobContainerItem;
import com.azure.storage.blob.models.BlobServiceProperties;
import com.azure.storage.blob.models.ListBlobContainersOptions;
import com.azure.storage.blob.models.PublicAccessType;
import com.azure.storage.blob.models.StorageAccountInfo;
import com.azure.storage.blob.models.StorageServiceProperties;
import com.azure.storage.blob.models.StorageServiceStats;
import com.azure.storage.blob.models.UserDelegationKey;
import com.azure.storage.common.Utility;
import reactor.core.publisher.Mono;

import java.time.Duration;
import java.time.OffsetDateTime;
import java.util.Map;
import reactor.core.publisher.Mono;

/**
* Client to a storage account. It may only be instantiated through a {@link BlobServiceClientBuilder}. This class does
Expand Down Expand Up @@ -191,7 +192,7 @@ public PagedIterable<BlobContainerItem> listBlobContainers(ListBlobContainersOpt
*
* @return The storage account properties.
*/
public StorageServiceProperties getProperties() {
public BlobServiceProperties getProperties() {
return getPropertiesWithResponse(null, Context.NONE).getValue();
}

Expand All @@ -207,9 +208,9 @@ public StorageServiceProperties getProperties() {
* @param context Additional context that is passed through the Http pipeline during the service call.
* @return A {@link Response} whose {@link Response#getValue() value} contains the storage account properties.
*/
public Response<StorageServiceProperties> getPropertiesWithResponse(Duration timeout, Context context) {
public Response<BlobServiceProperties> getPropertiesWithResponse(Duration timeout, Context context) {

Mono<Response<StorageServiceProperties>> response = blobServiceAsyncClient.getPropertiesWithResponse(context);
Mono<Response<BlobServiceProperties>> response = blobServiceAsyncClient.getPropertiesWithResponse(context);

return Utility.blockWithOptionalTimeout(response, timeout);
}
Expand All @@ -226,7 +227,7 @@ public Response<StorageServiceProperties> getPropertiesWithResponse(Duration tim
*
* @param properties Configures the service.
*/
public void setProperties(StorageServiceProperties properties) {
public void setProperties(BlobServiceProperties properties) {
setPropertiesWithResponse(properties, null, Context.NONE);
}

Expand All @@ -245,7 +246,7 @@ public void setProperties(StorageServiceProperties properties) {
* @param context Additional context that is passed through the Http pipeline during the service call.
* @return The storage account properties.
*/
public Response<Void> setPropertiesWithResponse(StorageServiceProperties properties, Duration timeout,
public Response<Void> setPropertiesWithResponse(BlobServiceProperties properties, Duration timeout,
Context context) {
Mono<Response<Void>> response = blobServiceAsyncClient.setPropertiesWithResponse(properties, context);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@
import com.azure.storage.blob.implementation.models.BlobsSetTierResponse;
import com.azure.storage.blob.implementation.models.BlobsStartCopyFromURLResponse;
import com.azure.storage.blob.implementation.models.BlobsUndeleteResponse;
import com.azure.storage.blob.implementation.models.DataLakeStorageErrorException;
import com.azure.storage.blob.implementation.models.DirectoryHttpHeaders;
import com.azure.storage.blob.models.AccessTier;
import com.azure.storage.blob.models.BlobHTTPHeaders;
import com.azure.storage.blob.models.CpkInfo;
import com.azure.storage.blob.implementation.models.DataLakeStorageErrorException;
import com.azure.storage.blob.models.DeleteSnapshotsOptionType;
import com.azure.storage.blob.models.EncryptionAlgorithmType;
import com.azure.storage.blob.models.LeaseAccessConditions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
import com.azure.core.implementation.DateTimeRfc1123;
import com.azure.core.implementation.RestProxy;
import com.azure.core.util.Context;
import com.azure.storage.blob.implementation.models.DataLakeStorageErrorException;
import com.azure.storage.blob.implementation.models.DirectoryHttpHeaders;
import com.azure.storage.blob.implementation.models.DirectorysCreateResponse;
import com.azure.storage.blob.implementation.models.DirectorysDeleteResponse;
import com.azure.storage.blob.implementation.models.DirectorysGetAccessControlResponse;
import com.azure.storage.blob.implementation.models.DirectorysRenameResponse;
import com.azure.storage.blob.implementation.models.DirectorysSetAccessControlResponse;
import com.azure.storage.blob.implementation.models.DataLakeStorageErrorException;
import com.azure.storage.blob.models.LeaseAccessConditions;
import com.azure.storage.blob.models.ModifiedAccessConditions;
import com.azure.storage.blob.models.PathRenameMode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
import com.azure.storage.blob.implementation.models.ServicesGetPropertiesResponse;
import com.azure.storage.blob.implementation.models.ServicesGetStatisticsResponse;
import com.azure.storage.blob.implementation.models.ServicesGetUserDelegationKeyResponse;
import com.azure.storage.blob.implementation.models.ServicesListContainersSegmentResponse;
import com.azure.storage.blob.implementation.models.ServicesListBlobContainersSegmentResponse;
import com.azure.storage.blob.implementation.models.ServicesSetPropertiesResponse;
import com.azure.storage.blob.implementation.models.ServicesSubmitBatchResponse;
import com.azure.storage.blob.models.BlobServiceProperties;
import com.azure.storage.blob.models.KeyInfo;
import com.azure.storage.blob.models.ListBlobContainersIncludeType;
import com.azure.storage.blob.models.StorageErrorException;
import com.azure.storage.blob.models.StorageServiceProperties;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

Expand Down Expand Up @@ -70,7 +70,7 @@ private interface ServicesService {
@Put("")
@ExpectedResponses({202})
@UnexpectedResponseExceptionType(StorageErrorException.class)
Mono<ServicesSetPropertiesResponse> 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);
Mono<ServicesSetPropertiesResponse> setProperties(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") BlobServiceProperties blobServiceProperties, @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("")
@ExpectedResponses({200})
Expand All @@ -85,7 +85,7 @@ private interface ServicesService {
@Get("")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(StorageErrorException.class)
Mono<ServicesListContainersSegmentResponse> listContainersSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker1, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") ListBlobContainersIncludeType 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);
Mono<ServicesListBlobContainersSegmentResponse> listBlobContainersSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("marker") String marker1, @QueryParam("maxresults") Integer maxresults, @QueryParam("include") ListBlobContainersIncludeType 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("")
@ExpectedResponses({200})
Expand All @@ -106,35 +106,35 @@ private interface ServicesService {
/**
* Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
*
* @param storageServiceProperties The StorageService properties.
* @param blobServiceProperties The StorageService properties.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ServicesSetPropertiesResponse> setPropertiesWithRestResponseAsync(StorageServiceProperties storageServiceProperties, Context context) {
public Mono<ServicesSetPropertiesResponse> setPropertiesWithRestResponseAsync(BlobServiceProperties blobServiceProperties, Context context) {
final Integer timeout = null;
final String requestId = null;
final String restype = "service";
final String comp = "properties";
return service.setProperties(this.client.getUrl(), storageServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context);
return service.setProperties(this.client.getUrl(), blobServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context);
}

/**
* Sets properties for a storage account's Blob service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules.
*
* @param storageServiceProperties The StorageService properties.
* @param blobServiceProperties The StorageService properties.
* @param timeout The timeout parameter is expressed in seconds. For more information, see &lt;a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations"&gt;Setting Timeouts for Blob Service Operations.&lt;/a&gt;.
* @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ServicesSetPropertiesResponse> setPropertiesWithRestResponseAsync(StorageServiceProperties storageServiceProperties, Integer timeout, String requestId, Context context) {
public Mono<ServicesSetPropertiesResponse> setPropertiesWithRestResponseAsync(BlobServiceProperties blobServiceProperties, Integer timeout, String requestId, Context context) {
final String restype = "service";
final String comp = "properties";
return service.setProperties(this.client.getUrl(), storageServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context);
return service.setProperties(this.client.getUrl(), blobServiceProperties, timeout, this.client.getVersion(), requestId, restype, comp, context);
}

/**
Expand Down Expand Up @@ -209,15 +209,15 @@ public Mono<ServicesGetStatisticsResponse> getStatisticsWithRestResponseAsync(In
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ServicesListContainersSegmentResponse> listContainersSegmentWithRestResponseAsync(Context context) {
public Mono<ServicesListBlobContainersSegmentResponse> listBlobContainersSegmentWithRestResponseAsync(Context context) {
final String prefix = null;
final String marker = null;
final Integer maxresults = null;
final ListBlobContainersIncludeType include = null;
final Integer timeout = null;
final String requestId = null;
final String comp = "list";
return service.listContainersSegment(this.client.getUrl(), prefix, marker, maxresults, include, timeout, this.client.getVersion(), requestId, comp, context);
return service.listBlobContainersSegment(this.client.getUrl(), prefix, marker, maxresults, include, timeout, this.client.getVersion(), requestId, comp, context);
}

/**
Expand All @@ -234,9 +234,9 @@ public Mono<ServicesListContainersSegmentResponse> listContainersSegmentWithRest
* @return a Mono which performs the network request upon subscription.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ServicesListContainersSegmentResponse> listContainersSegmentWithRestResponseAsync(String prefix, String marker, Integer maxresults, ListBlobContainersIncludeType include, Integer timeout, String requestId, Context context) {
public Mono<ServicesListBlobContainersSegmentResponse> listBlobContainersSegmentWithRestResponseAsync(String prefix, String marker, Integer maxresults, ListBlobContainersIncludeType include, Integer timeout, String requestId, Context context) {
final String comp = "list";
return service.listContainersSegment(this.client.getUrl(), prefix, marker, maxresults, include, timeout, this.client.getVersion(), requestId, comp, context);
return service.listBlobContainersSegment(this.client.getUrl(), prefix, marker, maxresults, include, timeout, this.client.getVersion(), requestId, comp, context);
}

/**
Expand Down
Loading