diff --git a/eng/spotbugs-aggregate-report/pom.xml b/eng/spotbugs-aggregate-report/pom.xml index df95e28e5936a..58bb9fb5c1d06 100644 --- a/eng/spotbugs-aggregate-report/pom.xml +++ b/eng/spotbugs-aggregate-report/pom.xml @@ -58,6 +58,7 @@ ..\..\core\azure-core-test\src\main\java ..\..\eventhubs\client\azure-eventhubs\src\main\java ..\..\eventhubs\client\azure-eventhubs\src\samples\java + ..\..\storage\client\file\src\samples\java diff --git a/pom.client.xml b/pom.client.xml index b09118509b848..bbb3d6f934978 100644 --- a/pom.client.xml +++ b/pom.client.xml @@ -389,6 +389,10 @@ Azure Storage - Blobs com.azure.storage.blob* + + Azure Storage - Files + com.azure.storage.file* + https://docs.oracle.com/javase/8/docs/api/ @@ -745,5 +749,6 @@ ./sdk/identity/azure-identity ./storage/client/blob + ./storage/client/file diff --git a/storage/client/file/pom.xml b/storage/client/file/pom.xml new file mode 100644 index 0000000000000..6bd8d18b4d1c6 --- /dev/null +++ b/storage/client/file/pom.xml @@ -0,0 +1,118 @@ + + + + com.azure + azure-client-sdk-parent + 1.1.0 + ../../../pom.client.xml + + + 4.0.0 + + com.azure + azure-storage-file + 12.0.0-preview.1 + + azure-storage-file + https://github.com/Azure/azure-sdk-for-java + + + + azure-java-build-docs + ${site.url}/site/${project.artifactId} + + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + + bintray + Groovy Bintray + https://dl.bintray.com/groovy/maven + + never + + + false + + + + + + + com.azure + azure-core + 1.0.0-preview.2 + + + org.slf4j + slf4j-api + + + + + com.google.code.findbugs + jsr305 + 3.0.2 + provided + + + + com.azure + azure-core-test + 1.0.0-preview.2 + test + + + com.azure + azure-identity + 1.0.0-preview.1 + test + + + junit + junit + test + + + org.slf4j + slf4j-simple + test + + + io.projectreactor + reactor-test + test + + + com.microsoft.azure + adal4j + test + + + org.spockframework + spock-core + test + + + cglib + cglib-nodep + test + + + uk.org.lidalia + slf4j-test + test + + + + diff --git a/storage/client/file/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java b/storage/client/file/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java index 19b2b4c307221..eadaf42ad6d36 100644 --- a/storage/client/file/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java +++ b/storage/client/file/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java @@ -112,7 +112,7 @@ public String computeHmac256(final String stringToSign) throws InvalidKeyExcepti byte[] utf8Bytes = stringToSign.getBytes(StandardCharsets.UTF_8); return Base64.getEncoder().encodeToString(hmacSha256.doFinal(utf8Bytes)); } catch (final NoSuchAlgorithmException e) { - throw new Error(e); + throw new RuntimeException(e); } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java b/storage/client/file/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java index 0669d18eb92f9..f81e78c5f9ca6 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java @@ -3,77 +3,513 @@ package com.azure.storage.file; +import com.azure.core.http.HttpPipeline; import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.util.Context; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.file.implementation.AzureFileStorageBuilder; +import com.azure.storage.file.implementation.AzureFileStorageImpl; import com.azure.storage.file.models.DirectoryInfo; import com.azure.storage.file.models.DirectoryProperties; +import com.azure.storage.file.models.DirectorySetMetadataInfo; +import com.azure.storage.file.models.DirectorysCreateResponse; +import com.azure.storage.file.models.DirectorysForceCloseHandlesResponse; +import com.azure.storage.file.models.DirectorysGetPropertiesResponse; +import com.azure.storage.file.models.DirectorysListFilesAndDirectoriesSegmentResponse; +import com.azure.storage.file.models.DirectorysListHandlesResponse; +import com.azure.storage.file.models.DirectorysSetMetadataResponse; import com.azure.storage.file.models.FileHTTPHeaders; import com.azure.storage.file.models.FileRef; import com.azure.storage.file.models.HandleItem; +import com.azure.storage.file.models.StorageErrorException; +import java.net.URL; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import java.util.Map; - +/** + * This class provides a client that contains all the operations for interacting with directory in Azure Storage File Service. + * Operations allowed by the client are creating, deleting and listing subdirectory and file, retrieving properties, , setting metadata + * and list or force close handles of the directory or file. + * + *

Instantiating an Asynchronous Directory Client

+ * + *
+ * DirectoryAsyncClient client = DirectoryAsyncClient.builder()
+ *     .connectionString(connectionString)
+ *     .endpoint(endpoint)
+ *     .buildAsyncClient();
+ * 
+ * + *

View {@link DirectoryClientBuilder this} for additional ways to construct the client.

+ * + * @see DirectoryClientBuilder + * @see DirectoryClient + * @see SharedKeyCredential + * @see SASTokenCredential + */ public class DirectoryAsyncClient { + private final AzureFileStorageImpl azureFileStorageClient; + private final String shareName; + private final String directoryName; + private final String shareSnapshot; + + /** + * Creates a DirectoryAsyncClient that sends requests to the storage directory at {@link AzureFileStorageImpl#url() endpoint}. + * Each service call goes through the {@link HttpPipeline pipeline} in the {@code client}. + * @param azureFileStorageClient Client that interacts with the service interfaces + * @param shareName Name of the share + * @param directoryName Name of the directory + * @param shareSnapshot The snapshot of the share + */ + DirectoryAsyncClient(AzureFileStorageImpl azureFileStorageClient, String shareName, String directoryName, String shareSnapshot) { + this.shareName = shareName; + this.directoryName = directoryName; + this.shareSnapshot = shareSnapshot; + this.azureFileStorageClient = new AzureFileStorageBuilder().pipeline(azureFileStorageClient.httpPipeline()) + .url(azureFileStorageClient.url()) + .version(azureFileStorageClient.version()) + .build(); + } - DirectoryAsyncClient() { - throw new UnsupportedOperationException(); + /** + * Creates a DirectoryAsyncClient that sends requests to the storage account at {@code endpoint}. + * Each service call goes through the {@code httpPipeline}. + * @param endpoint URL for the Storage File service + * @param httpPipeline HttpPipeline that HTTP requests and response flow through + * @param shareName Name of the share + * @param directoryName Name of the directory + * @param shareSnapshot Optional. The snapshot of the share + */ + DirectoryAsyncClient(URL endpoint, HttpPipeline httpPipeline, String shareName, String directoryName, String shareSnapshot) { + this.shareName = shareName; + this.directoryName = directoryName; + this.shareSnapshot = shareSnapshot; + this.azureFileStorageClient = new AzureFileStorageBuilder().pipeline(httpPipeline) + .url(endpoint.toString()) + .build(); } - public static DirectoryClientBuilder asyncBuilder() { - throw new UnsupportedOperationException(); + /** + * Get the getDirectoryUrl of the storage directory client. + * @return the URL of the storage directory client + */ + public String getDirectoryUrl() { + return azureFileStorageClient.url(); } - public FileAsyncClient getFileClient(String name) { - throw new UnsupportedOperationException(); + /** + * Constructs a FileAsyncClient that interacts with the specified file. + * + *

If the file doesn't exist in the storage account {@link FileAsyncClient#create(long)} create} in the client will + * need to be called before interaction with the file can happen.

+ * + * @param fileName Name of the file + * @return a FileAsyncClient that interacts with the specified share + */ + public FileAsyncClient getFileClient(String fileName) { + String filePath = directoryName + "/" + fileName; + return new FileAsyncClient(azureFileStorageClient, shareName, filePath, null); } - public DirectoryAsyncClient getDirectoryClient(String directoryName) { - throw new UnsupportedOperationException(); + /** + * Constructs a DirectoryAsyncClient that interacts with the specified directory. + * + *

If the file doesn't exist in the storage account {@link DirectoryAsyncClient#create()} create} in the client will + * need to be called before interaction with the directory can happen.

+ * + * @param directoryName Name of the directory + * @return a DirectoryAsyncClient that interacts with the specified directory + */ + public DirectoryAsyncClient getSubDirectoryClient(String directoryName) { + return new DirectoryAsyncClient(azureFileStorageClient, shareName, directoryName, shareSnapshot); } + /** + * Creates a directory in the storage account and returns a response of {@link DirectoryInfo} to interact with it. + * + *

Code Samples

+ * + *

Create the directory

+ * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.create} + * + * @return A response containing the directory info and the status of creating the directory. + * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. + */ + public Mono> create() { + return create(null); + } + + /** + * Creates a directory in the storage account and returns a response of DirectoryInfo to interact with it. + * + *

Code Samples

+ * + *

Create the directory

+ * + *
+     * client.create(Collections.singletonMap("directory", "metadata"))
+     *     .subscribe(response -> System.out.printf("Creating the directory completed with status code %d", response.statusCode()));
+     * 
+ * + * @param metadata Optional. Metadata to associate with the directory + * @return A response containing the directory info and the status of creating the directory. + * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. + */ public Mono> create(Map metadata) { - throw new UnsupportedOperationException(); + return azureFileStorageClient.directorys().createWithRestResponseAsync(shareName, directoryName,null, metadata, Context.NONE) + .map(this::createWithRestResponse); } + /** + * Deletes the directory in the storage account. + * + *

Code Samples

+ * + *

Delete the directory

+ * + * {@codesnippet com.azure.storage.file.directoryClient.delete} + * + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the share doesn't exist + */ public Mono delete() { - throw new UnsupportedOperationException(); + return azureFileStorageClient.directorys().deleteWithRestResponseAsync(shareName, directoryName, Context.NONE).map(VoidResponse::new) + .map(VoidResponse::new); + } + + /** + * Retrieves the properties of the storage account's directory. + * The properties includes directory metadata, last modified date, is server encrypted, and eTag. + * + *

Code Samples

+ * + *

Retrieve directory properties

+ * + *
+     * client.getProperties()
+     *    .subscribe(response -> {
+     *        DirectoryProperties properties = response.value();
+     *        System.out.printf("Directory latest modified date is %s.", properties.lastModified());
+     *    });
+     * 
+ * + * @return Storage directory properties + */ + public Mono> getProperties() { + return azureFileStorageClient.directorys().getPropertiesWithRestResponseAsync(shareName, directoryName, shareSnapshot, null, Context.NONE) + .map(this::getPropertiesResponse); } - public Mono> getProperties(String shareSnapshot) { - throw new UnsupportedOperationException(); + /** + * Sets the user-defined metadata to associate to the directory. + * + *

If {@code null} is passed for the metadata it will clear the metadata associated to the directory.

+ * + *

Code Samples

+ * + *

Set the metadata to "directory:updatedMetadata"

+ * + *
+     * client.setMetadata(Collections.singletonMap("directory", "updatedMetadata"))
+     *     .subscribe(response -> System.out.printf("Setting the directory metadata completed with status code %d", response.statusCode()));
+     * 
+ * + *

Clear the metadata of the directory

+ * + *
+     * client.setMetadata(null)
+     *     .subscribe(response -> System.out.printf("Clearing the directory metadata completed with status code %d", response.statusCode()));
+     * 
+ * + * @param metadata Optional. Metadata to set on the directory, if null is passed the metadata for the directory is cleared + * @return information about the directory + * @throws StorageErrorException If the directory doesn't exist or the metadata contains invalid keys + */ + public Mono> setMetadata(Map metadata) { + return azureFileStorageClient.directorys().setMetadataWithRestResponseAsync(shareName, directoryName, null, metadata, Context.NONE) + .map(this::setMetadataResponse); } - public Mono> setMetadata(Map metadata) { - throw new UnsupportedOperationException(); + /** + * Lists all directories and files in the storage account without their prefix or maxResult. + * + *

Code Samples

+ * + *

List all directories and files in the account

+ * + *
+     * client.listFilesAndDirectories()
+     *     .subscribe(result -> System.out.printf("The file or directory %s exists in the account", result.name()));
+     * 
+ * + * @return {@link FileRef File info} in the storage directory + */ + public Flux listFilesAndDirectories() { + return listFilesAndDirectories(null, null); } - public Flux listFilesAndDirectories(String prefix, int maxResults, String shareSnapshot) { - throw new UnsupportedOperationException(); + /** + * Lists all shares in the storage account with their prefix or snapshots. + * + *

Code Samples

+ * + *

List all directories with "subdir" prefix and return 10 results in the account

+ * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories} + * + * @param prefix Optional. Filters the results to return only files and directories whose name begins with the specified prefix. + * @param maxResults Optional. Specifies the maximum number of files and/or directories to return per page. + * If the request does not specify maxresults or specifies a value greater than 5,000, the server will return up to 5,000 items. + * @return {@link FileRef File info} in the storage account with prefix and max number of return results. + */ + public Flux listFilesAndDirectories(String prefix, Integer maxResults) { + return azureFileStorageClient.directorys().listFilesAndDirectoriesSegmentWithRestResponseAsync(shareName, directoryName, prefix, shareSnapshot, null, maxResults, null, Context.NONE) + .flatMapMany(response -> nextPageForFileAndDirecotries(response, prefix, maxResults)); } - public Flux getHandles(int maxResult, boolean recursive) { - throw new UnsupportedOperationException(); + /** + * List of open handles on a directory or a file. + * + *

Code Samples

+ * + *

Get 10 handles with recursive call.

+ * + *
+     * client.getHandles(10, true)
+     *     .subscribe(handleItem -> System.out.printf("Get handles completed with handle id %s", handleItem.handleId()));
+     * 
+ * @param maxResult Optional. The number of results will return per page + * @param recursive Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. + * @return {@link HandleItem handles} in the directory that satisfy the requirements + */ + public Flux getHandles(Integer maxResult, boolean recursive) { + return azureFileStorageClient.directorys().listHandlesWithRestResponseAsync(shareName, directoryName, null, maxResult, null, shareSnapshot, recursive, Context.NONE) + .flatMapMany(response -> nextPageForHandles(response, maxResult, recursive)); } + /** + * Closes a handle or handles opened on a directory or a file at the service. It is intended to be used alongside {@link DirectoryAsyncClient#getHandles(Integer, boolean)} . + * + *

Code Samples

+ * + *

Force close handles with handles returned by get handles in recursive.

+ * + *
+     * client.getHandles(10, true)
+     *     .subscribe(handleItem -> {
+     *         client.forceCloseHandles(handleItem.handleId(), true).subscribe(numOfClosedHandles ->
+     *              System.out.printf("Close %d handles.", numOfClosedHandles)
+     *     )});
+     * 
+ * @param handleId Specifies the handle ID to be closed. Use an asterisk ('*') as a wildcard string to specify all handles. + * @param recursive A boolean value that specifies if the operation should also apply to the files and subdirectories of the directory specified in the URI. + * @return The counts of number of handles closed + */ public Flux forceCloseHandles(String handleId, boolean recursive) { - throw new UnsupportedOperationException(); + return azureFileStorageClient.directorys().forceCloseHandlesWithRestResponseAsync(shareName, directoryName, handleId, null, null, shareSnapshot, recursive, Context.NONE) + .flatMapMany(response -> nextPageForForceCloseHandles(response, handleId, recursive)); } - public Mono> createSubDirectory(String directoryName, Map metadata) { - throw new UnsupportedOperationException(); + /** + * Creates a subdirectory under current directory with specific name and returns a response of DirectoryAsyncClient to interact with it. + * + *

Code Samples

+ * + *

Create the sub directory "subdir"

+ * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.createSubDirectory#string} + * + * @param subDirectoryName Name of the subdirectory + * @return A response containing the subdirectory client and the status of creating the directory. + * @throws StorageErrorException If the subdirectory has already existed, the parent directory does not exist or directory is an invalid resource name. + */ + public Mono> createSubDirectory(String subDirectoryName) { + String directoryPath = directoryName + "/" + subDirectoryName; + DirectoryAsyncClient createSubClient = new DirectoryAsyncClient(azureFileStorageClient, shareName, directoryPath, shareSnapshot); + return createSubClient.create() + .map(response -> new SimpleResponse<>(response, createSubClient)); } - public Mono deleteSubDirectory(String directoryName) { - throw new UnsupportedOperationException(); + /** + * Creates a subdirectory under current directory with specific name , metadata and returns a response of DirectoryAsyncClient to interact with it. + * + *

Code Samples

+ * + *

Create the subdirectory named "subdir", with metadata

+ * + *
+     * client.createSubDirectory("subdir", Collections.singletonMap("directory", "metadata"))
+     *     .subscribe(response -> System.out.printf("Creating the subdirectory completed with status code %d", response.statusCode()));
+     * 
+ * + * @param subDirectoryName Name of the subdirectory + * @param metadata Optional. Metadata to associate with the subdirectory + * @return A response containing the subdirectory client and the status of creating the directory. + * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or subdirectory is an invalid resource name. + */ + public Mono> createSubDirectory(String subDirectoryName, Map metadata) { + String directoryPath = directoryName + "/" + subDirectoryName; + DirectoryAsyncClient createSubClient = new DirectoryAsyncClient(azureFileStorageClient, shareName, directoryPath, shareSnapshot); + return createSubClient.create(metadata) + .map(response -> new SimpleResponse<>(response, createSubClient)); } - public Mono> createFile(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map meatadata) { - throw new UnsupportedOperationException(); + /** + * Deletes the subdirectory with specific name in the storage account. + * + *

Code Samples

+ * + *

Delete the subdirectory named "subdir"

+ * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.deleteSubDirectory#string} + * + * @param subDirectoryName Name of the subdirectory + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the subdirectory doesn't exist, the parent directory does not exist or subdirectory name is an invalid resource name. + */ + public Mono deleteSubDirectory(String subDirectoryName) { + String directoryPath = directoryName + "/" + subDirectoryName; + DirectoryAsyncClient deleteSubClient = new DirectoryAsyncClient(azureFileStorageClient, shareName, directoryPath, shareSnapshot); + return deleteSubClient.delete().map(VoidResponse::new); } + /** + * Creates a file in the storage account with specific name, max number of results and returns a response of DirectoryInfo to interact with it. + * + *

Code Samples

+ * + *

Create 1k file with named "myFile"

+ * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.createFile#string-long} + * + * @param fileName Name of the file + * @param maxSize Size of the file + * @return A response containing the FileAsyncClient and the status of creating the directory. + * @throws StorageErrorException If the file has already existed, the parent directory does not exist or file name is an invalid resource name. + */ + public Mono> createFile(String fileName, long maxSize) { + String filePath = directoryName + "/" + fileName; + FileAsyncClient fileAsyncClient = new FileAsyncClient(azureFileStorageClient, shareName, filePath, shareSnapshot); + return fileAsyncClient.create(maxSize).map(response -> new SimpleResponse<>(response, fileAsyncClient)); + } + + /** + * Creates a file in the storage account with specific name and returns a response of DirectoryInfo to interact with it. + * + *

Code Samples

+ * + *

Create the file named "myFile"

+ * + *
+     * client.createFile("myFile", Collections.singletonMap("directory", "metadata"))
+     *     .subscribe(response -> System.out.printf("Creating the file completed with status code %d", response.statusCode()));
+     * 
+ * + * @param fileName Name of the file + * @param maxSize Max size of the file + * @param httpHeaders the Http headers set to the file + * @param metadata Optional. Name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. + * @return A response containing the directory info and the status of creating the directory. + * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or file name is an invalid resource name. + */ + public Mono> createFile(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { + String filePath = directoryName + "/" + fileName; + FileAsyncClient fileAsyncClient = new FileAsyncClient(azureFileStorageClient, shareName, filePath, shareSnapshot); + return fileAsyncClient.create(maxSize, httpHeaders, metadata).map(response -> new SimpleResponse<>(response, fileAsyncClient)); + } + + /** + * Deletes the file with specific name in the storage account. + * + *

Code Samples

+ * + *

Delete the file "filetest"

+ * + * {@codesnippet com.azure.storage.file.directoryAsyncClient.deleteFile#string} + * + * @param fileName Name of the file + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist or file name is an invalid resource name. + */ public Mono deleteFile(String fileName) { - throw new UnsupportedOperationException(); + String filePath = directoryName + "/" + fileName; + FileAsyncClient fileAsyncClient = new FileAsyncClient(azureFileStorageClient, shareName, filePath, shareSnapshot); + return fileAsyncClient.delete().map(VoidResponse::new); + } + + + private Response createWithRestResponse(final DirectorysCreateResponse response) { + String eTag = response.deserializedHeaders().eTag(); + OffsetDateTime lastModified = response.deserializedHeaders().lastModified(); + DirectoryInfo directoryInfo = new DirectoryInfo(eTag, lastModified); + return new SimpleResponse<>(response, directoryInfo); + + } + + private Response getPropertiesResponse(DirectorysGetPropertiesResponse response) { + Map metadata = response.deserializedHeaders().metadata(); + String eTag = response.deserializedHeaders().eTag(); + OffsetDateTime offsetDateTime = response.deserializedHeaders().lastModified(); + boolean isServerEncrypted = response.deserializedHeaders().isServerEncrypted(); + + DirectoryProperties directoryProperties = new DirectoryProperties(metadata, eTag, offsetDateTime, isServerEncrypted); + return new SimpleResponse<>(response, directoryProperties); + } + + private Response setMetadataResponse(final DirectorysSetMetadataResponse response) { + String eTag = response.deserializedHeaders().eTag(); + boolean isServerEncrypted = response.deserializedHeaders().isServerEncrypted(); + + DirectorySetMetadataInfo directorySetMetadataInfo = new DirectorySetMetadataInfo(eTag, isServerEncrypted); + return new SimpleResponse<>(response, directorySetMetadataInfo); + } + + private Flux nextPageForFileAndDirecotries(final DirectorysListFilesAndDirectoriesSegmentResponse response, final String prefix, final Integer maxResult) { + List fileRefs = convertResponseAndGetNumOfResults(response); + + if (response.value().nextMarker() == null) { + return Flux.fromIterable(fileRefs); + } + Mono listResponse = azureFileStorageClient.directorys().listFilesAndDirectoriesSegmentWithRestResponseAsync(shareName, directoryName, prefix, shareSnapshot, response.value().nextMarker(), maxResult, null, Context.NONE); + Flux fileRefPublisher = listResponse.flatMapMany(newResponse ->nextPageForFileAndDirecotries(newResponse, prefix, maxResult)); + return Flux.fromIterable(fileRefs).concatWith(fileRefPublisher); + } + + private Flux nextPageForHandles (DirectorysListHandlesResponse response, Integer maxResult, boolean recursive) { + List handleItems = response.value().handleList(); + + if (response.value().nextMarker() == null) { + return Flux.fromIterable(handleItems); + } + Mono listResponse = azureFileStorageClient.directorys().listHandlesWithRestResponseAsync(shareName, directoryName, response.value().nextMarker(), maxResult, null, shareSnapshot, recursive, Context.NONE); + Flux fileRefPublisher = listResponse.flatMapMany(newResponse -> nextPageForHandles(newResponse, maxResult, recursive)); + return Flux.fromIterable(handleItems).concatWith(fileRefPublisher); + } + + private Flux nextPageForForceCloseHandles(DirectorysForceCloseHandlesResponse response, String handleId, boolean recursive) { + List handleCount = Arrays.asList(response.deserializedHeaders().numberOfHandlesClosed()); + + if (response.deserializedHeaders().marker() == null) { + return Flux.fromIterable(handleCount); + } + Mono listResponse = azureFileStorageClient.directorys().forceCloseHandlesWithRestResponseAsync(shareName, directoryName, handleId, null, response.deserializedHeaders().marker(), shareSnapshot, recursive, Context.NONE); + Flux fileRefPublisher = listResponse.flatMapMany(newResponse -> nextPageForForceCloseHandles(newResponse, handleId, recursive)); + return Flux.fromIterable(handleCount).concatWith(fileRefPublisher); + } + + private List convertResponseAndGetNumOfResults(DirectorysListFilesAndDirectoriesSegmentResponse response){ + List fileRefs = new ArrayList<>(); + response.value().segment().directoryItems().forEach(directoryItem -> fileRefs.add(new FileRef(directoryItem.name(), true, null))); + response.value().segment().fileItems().forEach(fileItem -> fileRefs.add(new FileRef(fileItem.name(), false, fileItem.properties()))); + return fileRefs; } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/DirectoryClient.java b/storage/client/file/src/main/java/com/azure/storage/file/DirectoryClient.java index 22d4063b0f410..f7ebcab6c59ca 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/DirectoryClient.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/DirectoryClient.java @@ -4,78 +4,376 @@ package com.azure.storage.file; import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.DirectoryInfo; import com.azure.storage.file.models.DirectoryProperties; +import com.azure.storage.file.models.DirectorySetMetadataInfo; import com.azure.storage.file.models.FileHTTPHeaders; import com.azure.storage.file.models.FileRef; import com.azure.storage.file.models.HandleItem; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - +import com.azure.storage.file.models.StorageErrorException; import java.util.Map; +/** + * This class provides a client that contains all the operations for interacting with directory in Azure Storage File Service. + * Operations allowed by the client are creating, deleting and listing subdirectory and file, retrieving properties, , setting metadata + * and list or force close handles of the directory or file. + * + *

Instantiating an Synchronous Directory Client

+ * + *
+ * DirectoryClient client = DirectoryClient.builder()
+ *     .connectionString(connectionString)
+ *     .endpoint(endpoint)
+ *     .buildClient();
+ * 
+ * + *

View {@link DirectoryClientBuilder this} for additional ways to construct the client.

+ * + * @see DirectoryClientBuilder + * @see DirectoryClient + * @see SharedKeyCredential + * @see SASTokenCredential + */ public class DirectoryClient { - private final DirectoryAsyncClient client; + public final DirectoryAsyncClient directoryAsyncClient; + + /** + * Creates a DirectoryClient that wraps a DirectoryAsyncClient and blocks requests. + * + * @param directoryAsyncClient DirectoryAsyncClient that is used to send requests + */ + DirectoryClient(DirectoryAsyncClient directoryAsyncClient) { + this.directoryAsyncClient = directoryAsyncClient; + } + + /** + * Get the getDirectoryUrl of the storage directory client. + * @return the URL of the storage directory client + */ + public String getDirectoryUrl() { + return directoryAsyncClient.getDirectoryUrl(); + } + + /** + * Constructs a FileClient that interacts with the specified file. + * + *

If the file doesn't exist in the storage account {@link FileClient#create(long)} create} in the client will + * need to be called before interaction with the file can happen.

+ * + * @param fileName Name of the file + * @return a FileClient that interacts with the specified share + */ + public FileClient getFileClient(String fileName) { + return new FileClient(directoryAsyncClient.getFileClient(fileName)); + } + + /** + * Constructs a DirectoryClient that interacts with the specified directory. + * + *

If the file doesn't exist in the storage account {@link DirectoryClient#create()} create} in the client will + * need to be called before interaction with the directory can happen.

+ * + * @param directoryName Name of the directory + * @return a DirectoryClient that interacts with the specified directory + */ + public DirectoryClient getSubDirectoryClient(String directoryName) { + return new DirectoryClient(directoryAsyncClient.getSubDirectoryClient(directoryName)); + } - DirectoryClient() { - throw new UnsupportedOperationException(); + /** + * Creates a directory in the storage account and returns a response of {@link DirectoryInfo} to interact with it. + * + *

Code Samples

+ * + *

Create the directory

+ * + * {@codesnippet com.azure.storage.file.directoryClient.createDirectory} + * + * @return A response containing the directory info and the status of creating the directory. + * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. + */ + public Response create() { + return create(null); } - public static DirectoryClientBuilder syncBuilder() { - throw new UnsupportedOperationException(); + /** + * Creates a directory in the storage account and returns a response of DirectoryInfo to interact with it. + * + *

Code Samples

+ * + *

Create the directory

+ * + *
+     * Response<DirectoryInfo> response = client.create(Collections.singletonMap("directory", "metadata"));
+     * System.out.printf("Creating the directory completed with status code %d", response.statusCode());
+     * 
+ * + * @param metadata Optional. Metadata to associate with the directory + * @return A response containing the directory info and the status of creating the directory. + * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. + */ + public Response create(Map metadata) { + return directoryAsyncClient.create(metadata).block(); } - public FileClient getFileClient(String name) { - throw new UnsupportedOperationException(); + /** + * Deletes the directory in the storage account. The directory must be empty before it can be deleted. + * + *

Code Samples

+ * + *

Delete the directory

+ * + * {@codesnippet com.azure.storage.file.directoryClient.delete} + * + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the share doesn't exist + */ + public VoidResponse delete() { + return directoryAsyncClient.delete().block(); } - public DirectoryClient getDirectoryClient(String directoryName) { - throw new UnsupportedOperationException(); + /** + * Retrieves the properties of the storage account's directory. + * The properties includes directory metadata, last modified date, is server encrypted, and eTag. + * + *

Code Samples

+ * + *

Retrieve directory properties

+ * + *
+     * Response<DirectoryProperties> response = client.getProperties();
+     * System.out.printf("Directory latest modified date is %s.", properties.value().lastModified());
+     * 
+ * + * @return Storage directory properties + */ + public Response getProperties() { + return directoryAsyncClient.getProperties().block(); } - public Mono> create(Map metadata) { - throw new UnsupportedOperationException(); + /** + * Sets the user-defined metadata to associate to the directory. + * + *

If {@code null} is passed for the metadata it will clear the metadata associated to the directory.

+ * + *

Code Samples

+ * + *

Set the metadata to "directory:updatedMetadata"

+ * + *
+     * Response<DirectorySetMetadataInfo> response = client.setMetadata(Collections.singletonMap("directory", "updatedMetadata"));
+     * System.out.printf("Setting the directory metadata completed with status code %d", response.statusCode());
+     * 
+ * + *

Clear the metadata of the directory

+ * + *
+     * client.setMetadata(null)
+     *     .subscribe(response -> System.out.printf("Clearing the directory metadata completed with status code %d", response.statusCode()));
+     * 
+ * + * @param metadata Optional. Metadata to set on the directory, if null is passed the metadata for the directory is cleared + * @return information about the directory + * @throws StorageErrorException If the directory doesn't exist or the metadata contains invalid keys + */ + public Response setMetadata(Map metadata) { + return directoryAsyncClient.setMetadata(metadata).block(); } - public Mono delete() { - throw new UnsupportedOperationException(); + /** + * Lists all directories and files in the storage account without their prefix or maxResult. + * + *

Code Samples

+ * + *

List all directories and files in the account

+ * + *
+     * Iterable<FileRef> result = client.listFilesAndDirectories()
+     * System.out.printf("The file or directory %s exists in the account", result.iterator().next().name());
+     * 
+ * + * @return {@link FileRef File info} in the storage directory + */ + public Iterable listFilesAndDirectories() { + return listFilesAndDirectories(null, null); } - public Mono> getProperties(String shareSnapshot) { - throw new UnsupportedOperationException(); + /** + * Lists all shares in the storage account with their prefix or snapshots. + * + *

Code Samples

+ * + *

List all directories with "subdir" prefix and return 10 results in the account

+ * + * {@codesnippet com.azure.storage.file.directoryClient.listFilesAndDirectories} + * + * @param prefix Optional. Filters the results to return only files and directories whose name begins with the specified prefix. + * @param maxResults Optional. Specifies the maximum number of files and/or directories to return per page. + * If the request does not specify maxresults or specifies a value greater than 5,000, the server will return up to 5,000 items. + * @return {@link FileRef File info} in the storage account with prefix and max number of return results. + */ + public Iterable listFilesAndDirectories(String prefix, Integer maxResults) { + return directoryAsyncClient.listFilesAndDirectories(prefix, maxResults).toIterable(); } - public Mono> setMetadata(Map metadata) { - throw new UnsupportedOperationException(); + /** + * List of open handles on a directory or a file. + * + *

Code Samples

+ * + *

Get 10 handles with recursive call.

+ * + *
+     * Iterable<HandleItem> result = client.getHandles(10, true)
+     * System.out.printf("Get handles completed with handle id %s", result.iterator().next().handleId());
+     * 
+ * @param maxResult Optional. The number of results will return per page + * @param recursive Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. + * @return {@link HandleItem handles} in the directory that satisfy the requirements + */ + public Iterable getHandles(Integer maxResult, boolean recursive) { + return directoryAsyncClient.getHandles(maxResult, recursive).collectList().block(); } - public Flux listFilesAndDirectories(String prefix, int maxResults, String shareSnapshot) { - throw new UnsupportedOperationException(); + /** + * Closes a handle or handles opened on a directory or a file at the service. It is intended to be used alongside {@link DirectoryClient#getHandles(Integer, boolean)} . + * + *

Code Samples

+ * + *

Force close handles with handles returned by get handles in recursive.

+ * + *
+     * Iterable<HandleItem> result = client.getHandles(10, true)
+     * result.forEach(handleItem ->  {
+     *    client.forceCloseHandles(handleItem.handleId, true).forEach(numOfClosedHandles ->
+     *    System.out.printf("Get handles completed with handle id %s", handleItem.handleId()));
+     * });
+     * 
+ * @param handleId Specifies the handle ID to be closed. Use an asterisk ('*') as a wildcard string to specify all handles. + * @param recursive A boolean value that specifies if the operation should also apply to the files and subdirectories of the directory specified in the URI. + * @return The counts of number of handles closed. + */ + public Iterable forceCloseHandles(String handleId, boolean recursive) { + return directoryAsyncClient.forceCloseHandles(handleId, recursive).collectList().block(); } - public Flux getHandles(int maxResult, boolean recursive) { - throw new UnsupportedOperationException(); + /** + * Creates a subdirectory under current directory with specific name and returns a response of DirectoryClient to interact with it. + * + *

Code Samples

+ * + *

Create the sub directory "subdir"

+ * + *
+     * Response<DirectoryClient> response = client.createSubDirectory("subdir")
+     * System.out.printf("Creating the sub directory completed with status code %d", response.statusCode());
+     * 
+ * + * @param subDirectoryName Name of the subdirectory + * @return A response containing the subdirectory client and the status of creating the directory. + * @throws StorageErrorException If the subdirectory has already existed, the parent directory does not exist or directory is an invalid resource name. + */ + public Response createSubDirectory(String subDirectoryName) { + return createSubDirectory(subDirectoryName, null); } - public Flux forceCloseHandles(String handleId, boolean recursive) { - throw new UnsupportedOperationException(); + /** + * Creates a subdirectory under current directory with specific name , metadata and returns a response of DirectoryClient to interact with it. + * + *

Code Samples

+ * + *

Create the subdirectory named "subdir", with metadata

+ * + * com.azure.storage.file.directoryClient.createSubDirectory#string + * + * @param subDirectoryName Name of the subdirectory + * @param metadata Optional. Metadata to associate with the subdirectory + * @return A response containing the subdirectory client and the status of creating the directory. + * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or subdirectory is an invalid resource name. + */ + public Response createSubDirectory(String subDirectoryName, Map metadata) { + DirectoryClient directoryClient = getSubDirectoryClient(subDirectoryName); + return new SimpleResponse<>(directoryClient.create(metadata), directoryClient); } - public Mono> createSubDirectory(String directoryName, Map metadata) { - throw new UnsupportedOperationException(); + /** + * Deletes the subdirectory with specific name in the storage account. The directory must be empty before it can be deleted. + * + *

Code Samples

+ * + *

Delete the subdirectory named "subdir"

+ * + * {@codesnippet com.azure.storage.file.directoryClient.deleteSubDirectory#string} + * + * @param subDirectoryName Name of the subdirectory + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the subdirectory doesn't exist, the parent directory does not exist or subdirectory name is an invalid resource name. + */ + public VoidResponse deleteSubDirectory(String subDirectoryName) { + return directoryAsyncClient.deleteSubDirectory(subDirectoryName).block(); } - public Mono deleteSubDirectory(String directoryName) { - throw new UnsupportedOperationException(); + /** + * Creates a file in the storage account with specific name, max number of results and returns a response of DirectoryInfo to interact with it. + * + *

Code Samples

+ * + *

Create 1k file with named "myFile"

+ * + * {@codesnippet com.azure.storage.file.directoryClient.createFile#string-long} + * + * @param fileName Name of the file + * @param maxSize Size of the file + * @return A response containing the FileClient and the status of creating the directory. + * @throws StorageErrorException If the file has already existed, the parent directory does not exist or file name is an invalid resource name. + */ + public Response createFile(String fileName, long maxSize) { + return createFile(fileName, maxSize, null, null); } - public Mono> createFile(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map meatadata) { - throw new UnsupportedOperationException(); + /** + * Creates a file in the storage account with specific name and returns a response of DirectoryInfo to interact with it. + * + *

Code Samples

+ * + *

Create the file named "myFile"

+ * + *
+     * Response<FileClient> response = client.createFile("myFile", Collections.singletonMap("directory", "metadata"))
+     * System.out.printf("Creating the file completed with status code %d", response.statusCode());
+     * 
+ * + * @param fileName Name of the file + * @param maxSize Max size of the file + * @param httpHeaders the Http headers set to the file + * @param metadata Optional. Name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. + * @return A response containing the directory info and the status of creating the directory. + * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or file name is an invalid resource name. + */ + public Response createFile(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { + return directoryAsyncClient.createFile(fileName, maxSize, httpHeaders, metadata) + .map(response -> new SimpleResponse<>(response, new FileClient(response.value()))).block(); } - public Mono deleteFile(String fileName) { - throw new UnsupportedOperationException(); + /** + * Deletes the file with specific name in the storage account. + * + *

Code Samples

+ * + *

Delete the file "filetest"

+ * + * {@codesnippet com.azure.storage.file.directoryClient.deleteFile#string} + * + * @param fileName Name of the file + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist or file name is an invalid resource name. + */ + public VoidResponse deleteFile(String fileName) { + return directoryAsyncClient.deleteFile(fileName).block(); } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/DirectoryClientBuilder.java b/storage/client/file/src/main/java/com/azure/storage/file/DirectoryClientBuilder.java index 7bbd3cb138d2e..86f108e0df804 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/DirectoryClientBuilder.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/DirectoryClientBuilder.java @@ -3,7 +3,347 @@ package com.azure.storage.file; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; +import com.azure.core.util.configuration.Configuration; +import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.common.policy.SASTokenCredentialPolicy; +import com.azure.storage.common.policy.SharedKeyCredentialPolicy; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link DirectoryClient FileClients} + * and {@link DirectoryAsyncClient FileAsyncClients}, calling {@link DirectoryClientBuilder#buildClient() buildClient} + * constructs an instance of FileClient and calling {@link DirectoryClientBuilder#buildAsyncClient() buildAsyncClient} + * constructs an instance of FileAsyncClient. + * + *

The client needs the endpoint of the Azure Storage File service, name of the share, and authorization credential. + * {@link DirectoryClientBuilder#endpoint(String) endpoint} gives the builder the endpoint and may give the builder the + * {@link DirectoryClientBuilder#shareName(String)}, {@link DirectoryClientBuilder#directoryName(String)} and a {@link SASTokenCredential} that authorizes the client.

+ * + *

Instantiating a synchronous Directory Client with SAS token

+ * {@codesnippet com.azure.storage.file.directoryClient.instantiation.sastoken} + * + *

Instantiating an Asynchronous Directory Client with SAS token

+ * {@codesnippet com.azure.storage.file.directoryClient.instantiation.sastoken} + * + *
+ * DirectoryClient client = DirectoryClient.builder()
+ *     .endpoint(endpointWithSASTokenQueryParams)
+ *     .buildClient();
+ * 
+ * + *
+ * DirectoryAsyncClient client = DirectoryAsyncClient.builder()
+ *     .endpoint(endpointWithSASTokenQueryParams)
+ *     .buildAsyncClient();
+ * 
+ * + *

If the {@code endpoint} doesn't contain the query parameters to construct a {@code SASTokenCredential} they may + * be set using {@link DirectoryClientBuilder#credential(SASTokenCredential) credential}.

+ * + * + *

Another way to authenticate the client is using a {@link SharedKeyCredential}. To create a SharedKeyCredential + * a connection string from the Storage File service must be used. Set the SharedKeyCredential with + * {@link DirectoryClientBuilder#connectionString(String) connectionString}. If the builder has both a SASTokenCredential and + * SharedKeyCredential the SharedKeyCredential will be preferred when authorizing requests sent to the service.

+ * + *

Instantiating a synchronous Directory Client with connection string.

+ * {@codesnippet com.azure.storage.file.directoryClient.instantiation.connectionstring} + * + *

Instantiating an Asynchronous Directory Client with connection string.

+ * {@codesnippet com.azure.storage.file.directoryAsyncClient.instantiation.connectionstring} + * + * @see DirectoryClient + * @see DirectoryAsyncClient + * @see SASTokenCredential + * @see SharedKeyCredential + */ public class DirectoryClientBuilder { + private static final String ACCOUNT_NAME = "AccountName".toLowerCase(); + private final List policies; + private final RetryPolicy retryPolicy; + + private HttpLogDetailLevel logLevel; + private Configuration configuration; + private URL endpoint; + private String shareName; + private String directoryName; + private SASTokenCredential sasTokenCredential; + private SharedKeyCredential sharedKeyCredential; + private HttpClient httpClient; + private HttpPipeline pipeline; + private String shareSnapshot; + + /** + * Creates a builder instance that is able to configure and construct {@link DirectoryClient DirectoryClients} + * and {@link DirectoryAsyncClient DirectoryAsyncClients}. + */ + public DirectoryClientBuilder() { + retryPolicy = new RetryPolicy(); + logLevel = HttpLogDetailLevel.NONE; + policies = new ArrayList<>(); + + configuration = ConfigurationManager.getConfiguration(); + } + + /** + * Creates a {@link DirectoryAsyncClient} based on options set in the builder. Every time {@code buildAsyncClient()} is + * called a new instance of {@link DirectoryAsyncClient} is created. + * + *

+ * If {@link DirectoryClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and + * {@link DirectoryClientBuilder#endpoint(String) endpoint} are used to create the + * {@link DirectoryAsyncClient client}. All other builder settings are ignored. + *

+ * + * @return A ShareAsyncClient with the options set from the builder. + * @throws NullPointerException If {@code endpoint} or {@code shareName} is {@code null}. + * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. + */ + public DirectoryAsyncClient buildAsyncClient() { + Objects.requireNonNull(endpoint); + + if (sasTokenCredential == null && sharedKeyCredential == null) { + throw new IllegalArgumentException("Credentials are required for authorization"); + } + + // Closest to API goes first, closest to wire goes last. + final List policies = new ArrayList<>(); + + policies.add(new UserAgentPolicy(FileConfiguration.NAME, FileConfiguration.VERSION, configuration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddDatePolicy()); + + if (sharedKeyCredential != null) { + policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); + } else { + policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); + } + + HttpPolicyProviders.addBeforeRetryPolicies(policies); + + policies.add(retryPolicy); + + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(logLevel)); + + HttpPipeline pipeline = HttpPipeline.builder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .build(); + + return new DirectoryAsyncClient(endpoint, pipeline, shareName, directoryName, shareSnapshot); + } + + /** + * Creates a {@link DirectoryClient} based on options set in the builder. Every time {@code buildClient()} is + * called a new instance of {@link DirectoryClient} is created. + * + *

+ * If {@link DirectoryClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and + * {@link DirectoryClientBuilder#endpoint(String) endpoint} are used to create the + * {@link DirectoryClient client}. All other builder settings are ignored. + *

+ * + * @return A DirectoryClient with the options set from the builder. + * @throws NullPointerException If {@code endpoint}, {@code shareName} or {@code directoryName} is {@code null}. + * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. + */ + public DirectoryClient buildClient() { + return new DirectoryClient(this.buildAsyncClient()); + } + + /** + * Sets the endpoint for the Azure Storage File instance that the client will interact with. + * + *

The first path segment, if the endpoint contains path segments, will be assumed to be the name of the share + * that the client will interact with. Rest of the path segments should be the path of the directory.

+ * + *

Query parameters of the endpoint will be parsed using {@link SASTokenCredential#fromQuery(String)} in an + * attempt to generate a {@link SASTokenCredential} to authenticate requests sent to the service.

+ * + * @param endpoint The URL of the Azure Storage File instance to send service requests to and receive responses from. + * @return the updated DirectoryClientBuilder object + * @throws IllegalArgumentException If {@code endpoint} is {@code null} or is an invalid URL + */ + public DirectoryClientBuilder endpoint(String endpoint) { + Objects.requireNonNull(endpoint); + try { + URL fullURL = new URL(endpoint); + this.endpoint = new URL(fullURL.getProtocol() + "://" + fullURL.getHost()); + String[] pathSegments = fullURL.getPath().split("/"); + int length = pathSegments.length; + this.shareName = length >= 2 ? pathSegments[1] : this.shareName; + this.directoryName = length >= 3 ? pathSegments[2] : this.directoryName; + + // Attempt to get the SAS token from the URL passed + SASTokenCredential credential = SASTokenCredential.fromQuery(fullURL.getQuery()); + if (credential != null) { + this.sasTokenCredential = credential; + } + } catch (MalformedURLException ex) { + throw new IllegalArgumentException("The Azure Storage Directory endpoint url is malformed."); + } + + return this; + } + + /** + * Sets the {@link SASTokenCredential} used to authenticate requests sent to the File service. + * + * @param credential SAS token credential generated from the Storage account that authorizes requests + * @return the updated DirectoryClientBuilder object + * @throws NullPointerException If {@code credential} is {@code null}. + */ + public DirectoryClientBuilder credential(SASTokenCredential credential) { + this.sasTokenCredential = credential; + return this; + } + + /** + * Creates a {@link SharedKeyCredential} from the {@code connectionString} used to authenticate requests sent to the + * File service. + * + * @param connectionString Connection string from the Access Keys section in the Storage account + * @return the updated DirectoryClientBuilder object + * @throws NullPointerException If {@code connectionString} is {@code null}. + */ + public DirectoryClientBuilder connectionString(String connectionString) { + Objects.requireNonNull(connectionString); + this.sharedKeyCredential = SharedKeyCredential.fromConnectionString(connectionString); + getEndPointFromConnectionString(connectionString); + return this; + } + + private void getEndPointFromConnectionString(String connectionString) { + Map connectionStringPieces = new HashMap<>(); + for (String connectionStringPiece : connectionString.split(";")) { + String[] kvp = connectionStringPiece.split("=", 2); + connectionStringPieces.put(kvp[0].toLowerCase(), kvp[1]); + } + String accountName = connectionStringPieces.get(ACCOUNT_NAME); + try { + this.endpoint = new URL(String.format("https://%s.file.core.windows.net", accountName)); + } catch (MalformedURLException e) { + throw new IllegalArgumentException(String.format("There is no valid endpoint for the connection string. " + + "Connection String: %s", connectionString)); + } + } + + /** + * Sets the share that the constructed clients will interact with + * + * @param shareName Name of the share + * @return the updated DirectoryClientBuilder object + * @throws NullPointerException If {@code shareName} is {@code null}. + */ + public DirectoryClientBuilder shareName (String shareName) { + this.shareName = shareName; + return this; + } + + /** + * Sets the directory that the constructed clients will interact with + * + * @param directoryName Path to the directory + * @return the updated DirectoryClientBuilder object + * @throws NullPointerException If {@code directoryName} is {@code null}. + */ + public DirectoryClientBuilder directoryName(String directoryName) { + this.directoryName = directoryName; + return this; + } + + /** + * Sets the HTTP client to use for sending and receiving requests to and from the service. + * + * @param httpClient The HTTP client to use for requests. + * @return The updated DirectoryClientBuilder object. + * @throws NullPointerException If {@code httpClient} is {@code null}. + */ + public DirectoryClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /** + * Adds a policy to the set of existing policies that are executed after the {@link RetryPolicy}. + * + * @param pipelinePolicy The retry policy for service requests. + * @return The updated DirectoryClientBuilder object. + * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. + */ + public DirectoryClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { + this.policies.add(pipelinePolicy); + return this; + } + + /** + * Sets the logging level for HTTP requests and responses. + * + * @param logLevel The amount of logging output when sending and receiving HTTP requests/responses. + * @return The updated DirectoryClientBuilder object. + */ + public DirectoryClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { + this.logLevel = logLevel; + return this; + } + + /** + * Sets the HTTP pipeline to use for the service client. + * + *

If {@code pipeline} is set, all other settings are ignored, aside from {@link DirectoryClientBuilder#endpoint(String) endpoint}, + * {@link DirectoryClientBuilder#shareName(String) shareName} @{link DirectoryClientBuilder#directoryName(String) filePath}, and {@link DirectoryClientBuilder#shareSnapshot(String) snaphotShot} + * when building clients.

+ * + * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. + * @return The updated DirectoryClientBuilder object. + * @throws NullPointerException If {@code pipeline} is {@code null}. + */ + public DirectoryClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = Objects.requireNonNull(pipeline); + return this; + } + + /** + * Sets the configuration object used to retrieve environment configuration values used to buildClient the client with + * when they are not set in the builder, defaults to Configuration.NONE + * @param configuration configuration store + * @return the updated DirectoryClientBuilder object + */ + public DirectoryClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } -// connectionString, shareName, directoryName, FileClientOptions, SharedKeyCredential, + /** + * Sets the snapshot that the constructed clients will interact with. This snapshot must be linked to the share + * that has been specified in the builder. + * + * @param shareSnapshot Identifier of the snapshot + * @return the updated DirectoryClientBuilder object + * @throws NullPointerException If {@code shareSnapshot} is {@code null}. + */ + public DirectoryClientBuilder shareSnapshot(String shareSnapshot) { + this.shareSnapshot = shareSnapshot; + return this; + } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/FileAsyncClient.java b/storage/client/file/src/main/java/com/azure/storage/file/FileAsyncClient.java index 0297818f4650b..7e4bce01eecd5 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/FileAsyncClient.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/FileAsyncClient.java @@ -3,77 +3,774 @@ package com.azure.storage.file; +import com.azure.core.http.HttpPipeline; import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.util.FluxUtil; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.file.implementation.AzureFileStorageBuilder; +import com.azure.storage.file.implementation.AzureFileStorageImpl; +import com.azure.storage.file.models.CopyStatusType; import com.azure.storage.file.models.FileCopyInfo; import com.azure.storage.file.models.FileDownloadInfo; +import com.azure.storage.file.models.FileGetPropertiesHeaders; import com.azure.storage.file.models.FileHTTPHeaders; import com.azure.storage.file.models.FileInfo; +import com.azure.storage.file.models.FileMetadataInfo; import com.azure.storage.file.models.FileProperties; -import com.azure.storage.file.models.FileRangeInfo; +import com.azure.storage.file.models.FileRange; import com.azure.storage.file.models.FileRangeWriteType; import com.azure.storage.file.models.FileUploadInfo; +import com.azure.storage.file.models.FileUploadRangeHeaders; +import com.azure.storage.file.models.FilesCreateResponse; +import com.azure.storage.file.models.FilesDownloadResponse; +import com.azure.storage.file.models.FilesForceCloseHandlesResponse; +import com.azure.storage.file.models.FilesGetPropertiesResponse; +import com.azure.storage.file.models.FilesGetRangeListResponse; +import com.azure.storage.file.models.FilesListHandlesResponse; +import com.azure.storage.file.models.FilesSetHTTPHeadersResponse; +import com.azure.storage.file.models.FilesSetMetadataResponse; +import com.azure.storage.file.models.FilesStartCopyResponse; +import com.azure.storage.file.models.FilesUploadRangeResponse; import com.azure.storage.file.models.HandleItem; +import com.azure.storage.file.models.StorageErrorException; import io.netty.buffer.ByteBuf; +import java.io.File; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.channels.AsynchronousFileChannel; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeoutException; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; +import reactor.core.scheduler.Schedulers; -import java.util.Map; - +/** + * This class provides a client that contains all the operations for interacting with file in Azure Storage File Service. + * Operations allowed by the client are creating, copying, uploading, downloading, deleting and listing on a file, retrieving properties, setting metadata + * and list or force close handles of the file. + * + *

Instantiating an Asynchronous File Client

+ * + *
+ * FileAsyncClient client = FileAsyncClient.builder()
+ *     .connectionString(connectionString)
+ *     .endpoint(endpoint)
+ *     .buildAsyncClient();
+ * 
+ * + *

View {@link FileClientBuilder this} for additional ways to construct the client.

+ * + * @see FileClientBuilder + * @see FileClient + * @see SharedKeyCredential + * @see SASTokenCredential + */ public class FileAsyncClient { - FileAsyncClient() { - throw new UnsupportedOperationException(); + private static final ClientLogger LOGGER = new ClientLogger(FileAsyncClient.class); + private static final long FILE_DEFAULT_BLOCK_SIZE = 4 * 1024 * 1024L; + + private final AzureFileStorageImpl azureFileStorageClient; + private final String shareName; + private final String filePath; + private final String shareSnapshot; + + /** + * Creates a FileAsyncClient that sends requests to the storage file at {@link AzureFileStorageImpl#url() endpoint}. + * Each service call goes through the {@link HttpPipeline pipeline} in the {@code client}. + * @param azureFileStorageClient Client that interacts with the service interfaces + * @param shareName Name of the share + * @param filePath Path to the file + * @param shareSnapshot The snapshot of the share + */ + FileAsyncClient(AzureFileStorageImpl azureFileStorageClient, String shareName, String filePath, String shareSnapshot) { + this.shareName = shareName; + this.filePath = filePath; + this.shareSnapshot = shareSnapshot; + this.azureFileStorageClient = new AzureFileStorageBuilder().pipeline(azureFileStorageClient.httpPipeline()) + .url(azureFileStorageClient.url()) + .version(azureFileStorageClient.version()) + .build(); + } + + /** + * Creates a FileAsyncClient that sends requests to the storage account at {@code endpoint}. + * Each service call goes through the {@code httpPipeline}. + * @param endpoint URL for the Storage File service + * @param httpPipeline HttpPipeline that HTTP requests and response flow through + * @param shareName Name of the share + * @param filePath Path to the file + * @param shareSnapshot Optional. The snapshot of the share + */ + FileAsyncClient(URL endpoint, HttpPipeline httpPipeline, String shareName, String filePath, String shareSnapshot) { + this.shareName = shareName; + this.filePath = filePath; + this.shareSnapshot = shareSnapshot; + this.azureFileStorageClient = new AzureFileStorageBuilder().pipeline(httpPipeline) + .url(endpoint.toString()) + .build(); } - public static FileClientBuilder asyncBuilder() { - throw new UnsupportedOperationException(); + /** + * Get the getFileUrl of the storage file client. + * @return the URL of the storage file client + * @throws MalformedURLException if no protocol is specified, or an + * unknown protocol is found, or {@code spec} is {@code null}. + */ + public URL getFileUrl() throws MalformedURLException { + return new URL(azureFileStorageClient.url()); } + /** + * Creates a file in the storage account and returns a response of {@link FileInfo} to interact with it. + * + *

Code Samples

+ * + *

Create the file with size 1KB.

+ * + * {@codesnippet com.azure.storage.file.fileClient.create} + * + * @param maxSize The maximum size in bytes for the file, up to 1 TiB. + * @return A response containing the file info and the status of creating the file. + * @throws StorageErrorException If the file has already existed, the parent directory does not exist or fileName is an invalid resource name. + */ + public Mono> create(long maxSize) { + return create(maxSize, null, null); + } + + /** + * Creates a file in the storage account and returns a response of FileInfo to interact with it. + * + *

Code Samples

+ * + *

Create the file with length of 1024 bytes, some headers and metadata.

+ * + *
+     * FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain");
+     * client.create(1024, httpHeaders, Collections.singletonMap("file", "updatedMetadata"))
+     *     .subscribe(response -> System.out.printf("Creating the file completed with status code %d", response.statusCode()));
+     * 
+ * + * @param maxSize The maximum size in bytes for the file, up to 1 TiB. + * @param httpHeaders Additional parameters for the operation. + * @param metadata Optional. Name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. + * @see C# identifiers + * @return A response containing the directory info and the status of creating the directory. + * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory is an invalid resource name. + */ public Mono> create(long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { - throw new UnsupportedOperationException(); + return azureFileStorageClient.files().createWithRestResponseAsync(shareName, filePath, maxSize, null, metadata, httpHeaders, Context.NONE) + .map(this::createResponse); } + /** + * Copies a blob or file to a destination file within the storage account. + * + *

Code Samples

+ * + *

Copy file from source url to the {@code filePath}

+ * + * {@codesnippet com.azure.storage.file.fileAsyncClient.startCopy#string-map} + * + * @param sourceUrl Specifies the URL of the source file or blob, up to 2 KB in length. + * @param metadata Optional. Name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. + * * @see C# identifiers + * @return A response containing the file copy info and the status of copying the file. + */ public Mono> startCopy(String sourceUrl, Map metadata) { - throw new UnsupportedOperationException(); + return azureFileStorageClient.files().startCopyWithRestResponseAsync(shareName, filePath, sourceUrl, null, metadata, Context.NONE) + .map(this::startCopyResponse); } + /** + * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. + * + *

Code Samples

+ * + *

Abort copy file from copy id("someCopyId")

+ * + *
+     * client.abortCopy("someCopyId")
+     *     .subscribe(response -> System.out.printf("Abort copying the file completed with status code %d", response.statusCode()));
+     * 
+ * + * @param copyId Specifies the copy id which has copying pending status associate with it. + * @return A response containing the status of aborting copy the file. + */ public Mono abortCopy(String copyId) { - throw new UnsupportedOperationException(); + return azureFileStorageClient.files().abortCopyWithRestResponseAsync(shareName, filePath, copyId, Context.NONE) + .map(VoidResponse::new); + } + + /** + * Downloads a file from the system, including its metadata and properties + * + *

Code Samples

+ * + *

Download the file to current folder.

+ * + *
+     * client.downloadToFile("someFilePath")
+     *     .doOnTerminate(() -> if (Files.exist(Paths.get("someFilePath"))) {
+     *          System.out.println("Download the file completed");
+     *     });
+     * 
+ * + * @param downloadFilePath The path where store the downloaded file + */ + public Mono downloadToFile(String downloadFilePath) { + return downloadToFile(downloadFilePath, null); + } + + /** + * Downloads a file from the system, including its metadata and properties + * + *

Code Samples

+ * + *

Download the file from 1024 to 2048 bytes to current folder.

+ * + * {@codesnippet com.azure.storage.file.fileAsyncClient.downloadToFile} + * + * @param downloadFilePath The path where store the downloaded file + * @param range Optional. Return file data only from the specified byte range. + */ + public Mono downloadToFile(String downloadFilePath, FileRange range) { + AsynchronousFileChannel channel; + try { + channel = AsynchronousFileChannel.open(Paths.get(downloadFilePath), StandardOpenOption.READ, StandardOpenOption.WRITE); + } catch (IOException e) { + return Mono.error(e); + } + return sliceFileRange(range) + .flatMap(chunk -> downloadWithProperties(chunk, false) + .map(dar -> dar.value().body()) + .subscribeOn(Schedulers.elastic()) + .flatMap(fbb -> FluxUtil.bytebufStreamToFile(fbb, channel, chunk.start() - (range == null ? 0 : range.start())) + .subscribeOn(Schedulers.elastic()) + .timeout(Duration.ofSeconds(300)) + .retry(3, throwable -> throwable instanceof IOException || throwable instanceof TimeoutException)) + .doOnTerminate(() -> + LOGGER.asInfo().log("Saved " + chunk.toString() + " on thread " + Thread.currentThread().getName()))) + .then() + .doOnTerminate(() -> { + try { + channel.close(); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + }); } - public Mono> downloadWithProperties(long offset, long length, boolean rangeGetContentMD5) { - throw new UnsupportedOperationException(); + private Flux sliceFileRange(FileRange fileRange) { + long offset = fileRange == null ? 0L : fileRange.start(); + Mono end; + if (fileRange != null) { + end = Mono.just(fileRange.end()); + } else { + end = Mono.empty(); + } + end = end.switchIfEmpty(getProperties().map(rb -> rb.value().contentLength())); + return end + .map(e -> { + List chunks = new ArrayList<>(); + for (long pos = offset; pos < e; pos += FILE_DEFAULT_BLOCK_SIZE) { + long count = FILE_DEFAULT_BLOCK_SIZE; + if (pos + count > e) { + count = e - pos; + } + chunks.add(new FileRange(pos, pos + count - 1)); + } + return chunks; + }) + .flatMapMany(Flux::fromIterable); } + /** + * Downloads a file from the system, including its metadata and properties + * + *

Code Samples

+ * + *

Download the file with its metadata and properties.

+ * + * {@codesnippet com.azure.storage.file.fileAsyncClient.downloadWithProperties} + * + * @return A response that only contains headers and response status code + */ + public Mono> downloadWithProperties() { + return downloadWithProperties(null, null); + } + + /** + * Downloads a file from the system, including its metadata and properties + * + *

Code Samples

+ * + *

Download the file from 1024 to 2048 bytes with its metadata and properties and without the contentMD5.

+ * + *
+     * client.downloadWithProperties(new Range(1024, 2048), false)
+     *     .subscribe(response -> System.out.printf("Downloading the file range completed with status code %d", response.statusCode()));
+     * 
+ * + * @param range Optional. Return file data only from the specified byte range. + * @param rangeGetContentMD5 Optional. When this header is set to true and specified together with the Range header, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size. + * @return A response that only contains headers and response status code + */ + public Mono> downloadWithProperties(FileRange range, Boolean rangeGetContentMD5) { + String rangeString = range == null ? null : range.toString(); + return azureFileStorageClient.files().downloadWithRestResponseAsync(shareName, filePath, null, rangeString, rangeGetContentMD5, Context.NONE) + .map(this::downloadWithPropertiesResponse); + } + + /** + * Deletes the file associate with the client. + * + *

Code Samples

+ * + *

Delete the file

+ * + * {@codesnippet com.azure.storage.file.fileAsyncClient.delete} + * + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist. + */ public Mono delete() { - throw new UnsupportedOperationException(); + return azureFileStorageClient.files().deleteWithRestResponseAsync(shareName, filePath, Context.NONE) + .map(VoidResponse::new); } - public Mono> getProperties(String shareSnapshot) { - throw new UnsupportedOperationException(); + /** + * Retrieves the properties of the storage account's file. + * The properties includes file metadata, last modified date, is server encrypted, and eTag. + * + *

Code Samples

+ * + *

Retrieve file properties

+ * + *
+     * client.getProperties()
+     *    .subscribe(response -> {
+     *        DirectoryProperties properties = response.value();
+     *        System.out.printf("File latest modified date is %s.", properties.lastModified());
+     *    });
+     * 
+ * + * @return Storage file properties + */ + public Mono> getProperties() { + return azureFileStorageClient.files().getPropertiesWithRestResponseAsync(shareName, filePath, shareSnapshot, null, Context.NONE) + .map(this::getPropertiesResponse); } + /** + * Sets the user-defined httpHeaders to associate to the file. + * + *

If {@code null} is passed for the httpHeaders it will clear the httpHeaders associated to the file.

+ * + *

Code Samples

+ * + *

Set the httpHeaders of contentType of "text/plain"

+ * + *
+     * FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain");
+     * client.setHttpHeaders(1024, httpHeaders)
+     *     .subscribe(response -> System.out.printf("Setting the file httpHeaders completed with status code %d", response.statusCode()));
+     * 
+ * + *

Clear the metadata of the file

+ * + *
+     * client.setHttpHeaders(1024, null)
+     *     .subscribe(response -> System.out.printf("Clearing the file httpHeaders completed with status code %d", response.statusCode()));
+     * 
+ * + * @param newFileSize New file size of the file + * @param httpHeaders Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are cleared. + * @return Response of the information about the file + * @throws IllegalArgumentException thrown if parameters fail the validation. + */ public Mono> setHttpHeaders(long newFileSize, FileHTTPHeaders httpHeaders) { - throw new UnsupportedOperationException(); + return azureFileStorageClient.files().setHTTPHeadersWithRestResponseAsync(shareName, filePath, null, newFileSize, httpHeaders, Context.NONE) + .map(this::setHttpHeadersResponse); } - public Mono> setMeatadata(Map meatadata) { - throw new UnsupportedOperationException(); + /** + * Sets the user-defined metadata to associate to the file. + * + *

If {@code null} is passed for the metadata it will clear the metadata associated to the file.

+ * + *

Code Samples

+ * + *

Set the metadata to "file:updatedMetadata"

+ * + *
+     * client.setMetadata(Collections.singletonMap("file", "updatedMetadata"))
+     *     .subscribe(response -> System.out.printf("Setting the file metadata completed with status code %d", response.statusCode()));
+     * 
+ * + *

Clear the metadata of the file

+ * + *
+     * client.setMetadata(null)
+     *     .subscribe(response -> System.out.printf("Clearing the file metadata completed with status code %d", response.statusCode()));
+     * 
+ * + * @param metadata Options.Metadata to set on the file, if null is passed the metadata for the file is cleared + * @return information about the file + * @throws StorageErrorException If the file doesn't exist or the metadata contains invalid keys + */ + public Mono> setMetadata(Map metadata) { + return azureFileStorageClient.files().setMetadataWithRestResponseAsync(shareName, filePath, null, metadata, Context.NONE) + .map(this::setMeatadataResponse); } - public Mono> upload(FileRangeWriteType type, long offset, long length, Flux data) { - throw new UnsupportedOperationException(); + /** + * Uploads a range of bytes to the beginning of a file in storage file service. Upload operations performs an in-place write on the specified file. + * + *

Code Samples

+ * + *

Upload "default" to the file.

+ * + * {@codesnippet com.azure.storage.file.fileAsyncClient.upload} + * + * @param data The data which will upload to the storage file. + * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero.. + * @return A response that only contains headers and response status code + * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) + */ + public Mono> upload(Flux data, long length) { + FileRange range = new FileRange(0, length - 1); + return azureFileStorageClient.files().uploadRangeWithRestResponseAsync(shareName, filePath, range.toString(), FileRangeWriteType.UPDATE, length, data, null, null, Context.NONE) + .map(this::uploadResponse); } - public Flux listRanges(long offset, long length, String shareSnapshot) { - throw new UnsupportedOperationException(); + /** + * Uploads a range of bytes to specific of a file in storage file service. Upload operations performs an in-place write on the specified file. + * + *

Code Samples

+ * + *

Upload the file from 1024 to 2048 bytes with its metadata and properties and without the contentMD5.

+ * + *
+     * ByteBuf defaultData = Unpooled.wrappedBuffer(defaultText.getBytes(StandardCharsets.UTF_8));
+     * client.upload(defaultData, defaultData.readableBytes())
+     *     .subscribe(response -> System.out.printf("Upload the bytes to file range completed with status code %d", response.statusCode()));
+     * 
+ * + * @param data The data which will upload to the storage file. + * @param offset Optional. The starting point of the upload range. It will start from the beginning if it is {@code null} + * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero. + * @param type You may specify one of the following options: + * - Update: Writes the bytes specified by the request body into the specified range. + * - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero. + * @return A response that only contains headers and response status code + * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) + */ + public Mono> upload(Flux data, long length, long offset, FileRangeWriteType type) { + FileRange range = new FileRange(offset, offset + length - 1); + return azureFileStorageClient.files().uploadRangeWithRestResponseAsync(shareName, filePath, range.toString(), type, length, data, null, null, Context.NONE) + .map(this::uploadResponse); } - public Flux listHandles(int maxResults) { - throw new UnsupportedOperationException(); + /** + * Uploads file to storage file service. + * + *

Code Samples

+ * + *

Upload the file from the source file path.

+ * + * {@codesnippet com.azure.storage.file.fileAsyncClient.uploadFromFile} + * + * @param uploadFilePath The path where store the source file to upload + */ + public Mono uploadFromFile(String uploadFilePath) { + return uploadFromFile(uploadFilePath, FileRangeWriteType.UPDATE); } + /** + * Uploads file to storage file service. + * + *

Code Samples

+ * + *

Upload the file from the source file path.

+ * + *
+     * client.uploadFromFile("someFilePath", FileRangeWriteType.UPDATE)
+     *     .doOnTerminate(() -> if (client.getProperties() != null) {
+     *          System.out.printf("Upload the file with length of %d completed", client.getProperties().block().value().contentLength());
+     *     });
+     * 
+ * + * @param uploadFilePath The path where store the source file to upload + * @param type You may specify one of the following options: + * - Update: Writes the bytes specified by the request body into the specified range. + * - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero. + */ + public Mono uploadFromFile(String uploadFilePath, FileRangeWriteType type) { + AsynchronousFileChannel channel; + try { + channel = AsynchronousFileChannel.open(Paths.get(uploadFilePath), StandardOpenOption.READ); + } catch (IOException e) { + return Mono.error(e); + } + return Flux.fromIterable(sliceFile(uploadFilePath)) + .flatMap(chunk -> { + return upload(FluxUtil.byteBufStreamFromFile(channel, chunk.start(), chunk.end() - chunk.start() + 1), chunk.end() - chunk.start() + 1, chunk.start(), type) + .timeout(Duration.ofSeconds(300)) + .retry(3, throwable -> throwable instanceof IOException || throwable instanceof TimeoutException); + }) + .then() + .doOnTerminate(() -> { + try { + channel.close(); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + }); + } + + private List sliceFile(String path) { + File file = new File(path); + assert file.exists(); + List ranges = new ArrayList<>(); + for (long pos = 0; pos < file.length(); pos += FILE_DEFAULT_BLOCK_SIZE) { + long count = FILE_DEFAULT_BLOCK_SIZE; + if (pos + count > file.length()) { + count = file.length() - pos; + } + ranges.add(new FileRange(pos, pos + count - 1)); + } + return ranges; + } + + /** + * List of valid ranges for a file. + * + *

Code Samples

+ * + *

List all ranges for the file client.

+ * + *
+     * client.listRanges()
+     *     .subscribe(range -> System.out.printf("List ranges completed with start: %d, end: %d", range.start(), range.end()));
+     * 
+ * + * @return {@link FileRange ranges} in the files. + */ + public Flux listRanges() { + return azureFileStorageClient.files().getRangeListWithRestResponseAsync(shareName, filePath, shareSnapshot, null, null, Context.NONE) + .flatMapMany(this::convertListRangesResponseToFileRangeInfo); + } + + /** + * List of valid ranges for a file. + * + *

Code Samples

+ * + *

List all ranges within the file range from 1KB to 2KB.

+ * + *
+     * client.listRanges(new FileRange(1024, 2048)
+     *     .subscribe(result -> System.out.printf("List ranges completed with start: %d, end: %d", result.start(), result.end()));
+     * 
+ * + * @param range Optional. Return file data only from the specified byte range. + * @return {@link FileRange ranges} in the files that satisfy the requirements + */ + public Flux listRanges(FileRange range) { + return azureFileStorageClient.files().getRangeListWithRestResponseAsync(shareName, filePath, shareSnapshot, null, range.toString(), Context.NONE) + .flatMapMany(this::convertListRangesResponseToFileRangeInfo); + } + + /** + * List of open handles on a file. + * + *

Code Samples

+ * + *

List all handles for the file client.

+ * + *
+     * client.listHandles()
+     *     .subscribe(result -> System.out.printf("List handles completed with handle id %s", result.handleId()));
+     * 
+ * + * @return {@link HandleItem handles} in the files that satisfy the requirements + */ + public Flux listHandles() { + return listHandles(null); + } + + /** + * List of open handles on a file. + * + *

Code Samples

+ * + *

List 10 handles for the file client.

+ * + *
+     * client.listHandles(10)
+     *     .subscribe(result -> System.out.printf("List handles completed with handle id %s", result.handleId()));     * 
+ * @param maxResults Optional. The number of results will return per page + * @return {@link HandleItem handles} in the file that satisfy the requirements + */ + public Flux listHandles(Integer maxResults) { + return azureFileStorageClient.files().listHandlesWithRestResponseAsync(shareName, filePath, null, maxResults, null, shareSnapshot, Context.NONE) + .flatMapMany(response -> nextPageForHandles(response, maxResults)); + } + + /** + * Closes a handle or handles opened on a file at the service. It is intended to be used alongside {@link FileAsyncClient#listHandles()} (Integer)} . + * + *

Code Samples

+ * + *

Force close handles with handles returned by list handles in recursive.

+ * + *
+     * client.listHandles(10)
+     *     .subscribe(result -> {
+     *         client.forceCloseHandles(result.handleId(), true).subscribe(numOfClosedHandles ->
+     *              System.out.printf("Close %d handles.", numOfClosedHandles)
+     *     )});
+     * 
+ * @param handleId Specifies the handle ID to be closed. Use an asterisk ('*') as a wildcard string to specify all handles. + * @return The counts of number of handles closed + */ public Flux forceCloseHandles(String handleId) { - throw new UnsupportedOperationException(); + return azureFileStorageClient.files().forceCloseHandlesWithRestResponseAsync(shareName, filePath, handleId, null, null, shareSnapshot, Context.NONE) + .flatMapMany(response -> nextPageForForceCloseHandles(response, handleId)); + } + + private Flux nextPageForForceCloseHandles(final FilesForceCloseHandlesResponse response, final String handleId) { + List handleCount = Arrays.asList(response.deserializedHeaders().numberOfHandlesClosed()); + + if (response.deserializedHeaders().marker() == null) { + return Flux.fromIterable(handleCount); + } + Mono listResponse = azureFileStorageClient.files().forceCloseHandlesWithRestResponseAsync(shareName, filePath, handleId, null, response.deserializedHeaders().marker(), shareSnapshot, Context.NONE); + Flux fileRefPublisher = listResponse.flatMapMany(newResponse -> nextPageForForceCloseHandles(newResponse, handleId)); + return Flux.fromIterable(handleCount).concatWith(fileRefPublisher); + } + + private Flux nextPageForHandles(final FilesListHandlesResponse response, final Integer maxResults) { + List handleItems = response.value().handleList(); + + if (response.value().nextMarker() == null) { + return Flux.fromIterable(handleItems); + } + + Mono listResponse = azureFileStorageClient.files().listHandlesWithRestResponseAsync(shareName, filePath, response.value().nextMarker(), maxResults, null, shareSnapshot, Context.NONE); + Flux fileRefPublisher = listResponse.flatMapMany(newResponse -> nextPageForHandles(newResponse, maxResults)); + return Flux.fromIterable(handleItems).concatWith(fileRefPublisher); + } + + private Response createResponse(final FilesCreateResponse response) { + String eTag = response.deserializedHeaders().eTag(); + OffsetDateTime lastModified = response.deserializedHeaders().lastModified(); + boolean isServerEncrypted = response.deserializedHeaders().isServerEncrypted(); + FileInfo fileInfo = new FileInfo(eTag, lastModified, isServerEncrypted); + return new SimpleResponse<>(response, fileInfo); + } + + private Response startCopyResponse(final FilesStartCopyResponse response) { + String eTag = response.deserializedHeaders().eTag(); + OffsetDateTime lastModified = response.deserializedHeaders().lastModified(); + String copyId = response.deserializedHeaders().copyId(); + CopyStatusType copyStatus = response.deserializedHeaders().copyStatus(); + FileCopyInfo fileCopyInfo = new FileCopyInfo(eTag, lastModified, copyId, copyStatus); + return new SimpleResponse<>(response, fileCopyInfo); + } + + private Response setHttpHeadersResponse(final FilesSetHTTPHeadersResponse response) { + String eTag = response.deserializedHeaders().eTag(); + OffsetDateTime lastModified = response.deserializedHeaders().lastModified(); + boolean isServerEncrypted = response.deserializedHeaders().isServerEncrypted(); + FileInfo fileInfo = new FileInfo(eTag, lastModified, isServerEncrypted); + return new SimpleResponse<>(response, fileInfo); + } + private Response downloadWithPropertiesResponse(final FilesDownloadResponse response) { + String eTag = response.deserializedHeaders().eTag(); + OffsetDateTime lastModified = response.deserializedHeaders().lastModified(); + Map metadata = response.deserializedHeaders().metadata(); + Long contentLength = response.deserializedHeaders().contentLength(); + String contentType = response.deserializedHeaders().contentType(); + String contentRange = response.deserializedHeaders().contentRange(); + Flux body = response.value(); + FileDownloadInfo fileDownloadInfo = new FileDownloadInfo(eTag, lastModified, metadata, contentLength, contentType, contentRange, body); + return new SimpleResponse<>(response, fileDownloadInfo); + } + + private Response getPropertiesResponse(final FilesGetPropertiesResponse response) { + FileGetPropertiesHeaders headers = response.deserializedHeaders(); + String eTag = headers.eTag(); + OffsetDateTime lastModified = headers.lastModified(); + Map metadata = headers.metadata(); + String fileType = headers.fileType(); + Long contentLength = headers.contentLength(); + String contentType = headers.contentType(); + byte[] contentMD5; + try { + contentMD5 = headers.contentMD5(); + } catch (NullPointerException e) { + contentMD5 = null; + } + String contentEncoding = headers.contentEncoding(); + String cacheControl = headers.cacheControl(); + String contentDisposition = headers.contentDisposition(); + OffsetDateTime copyCompletionTime = headers.copyCompletionTime(); + String copyStatusDescription = headers.copyStatusDescription(); + String copyId = headers.copyId(); + String copyProgress = headers.copyProgress(); + String copySource = headers.copySource(); + CopyStatusType copyStatus = headers.copyStatus(); + Boolean isServerEncrpted = headers.isServerEncrypted(); + FileProperties fileProperties = new FileProperties(eTag, lastModified, metadata, fileType, contentLength, + contentType, contentMD5, contentEncoding, cacheControl, contentDisposition, copyCompletionTime, copyStatusDescription, + copyId, copyProgress, copySource, copyStatus, isServerEncrpted); + return new SimpleResponse<>(response, fileProperties); + } + + private Response uploadResponse(final FilesUploadRangeResponse response) { + FileUploadRangeHeaders headers = response.deserializedHeaders(); + String eTag = headers.eTag(); + OffsetDateTime lastModified = headers.lastModified(); + byte[] contentMD5; + try { + contentMD5 = headers.contentMD5(); + } catch (NullPointerException e) { + contentMD5 = null; + } + Boolean isServerEncrypted = headers.isServerEncrypted(); + FileUploadInfo fileUploadInfo = new FileUploadInfo(eTag, lastModified, contentMD5, isServerEncrypted); + return new SimpleResponse<>(response, fileUploadInfo); + } + + private Response setMeatadataResponse(final FilesSetMetadataResponse response) { + String eTag = response.deserializedHeaders().eTag(); + boolean isServerEncrypted = response.deserializedHeaders().isServerEncrypted(); + FileMetadataInfo fileMetadataInfo = new FileMetadataInfo(eTag, isServerEncrypted); + return new SimpleResponse<>(response, fileMetadataInfo); + } + + private Flux convertListRangesResponseToFileRangeInfo(FilesGetRangeListResponse response) { + List fileRanges = new ArrayList<>(); + response.value().forEach(range -> { + long start = range.start(); + long end = range.end(); + fileRanges.add(new FileRange(start, end)); + }); + return Flux.fromIterable(fileRanges); } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/FileClient.java b/storage/client/file/src/main/java/com/azure/storage/file/FileClient.java index 3d6bacb4ff3ea..b25b36fd749ff 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/FileClient.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/FileClient.java @@ -5,78 +5,488 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.FileCopyInfo; import com.azure.storage.file.models.FileDownloadInfo; import com.azure.storage.file.models.FileHTTPHeaders; import com.azure.storage.file.models.FileInfo; +import com.azure.storage.file.models.FileMetadataInfo; import com.azure.storage.file.models.FileProperties; -import com.azure.storage.file.models.FileRangeInfo; +import com.azure.storage.file.models.FileRange; import com.azure.storage.file.models.FileRangeWriteType; import com.azure.storage.file.models.FileUploadInfo; import com.azure.storage.file.models.HandleItem; +import com.azure.storage.file.models.StorageErrorException; import io.netty.buffer.ByteBuf; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - +import java.net.MalformedURLException; +import java.net.URL; import java.util.Map; +import reactor.core.publisher.Flux; +/** + * This class provides a client that contains all the operations for interacting files under Azure Storage File Service. + * Operations allowed by the client are creating, uploading, copying, listing, downloading, and deleting files. + * + *

Instantiating a synchronous File Client

+ * + *
+ * FileClient client = FileClient.builder()
+ *        .connectionString(connectionString)
+ *        .endpoint(endpoint)
+ *        .buildClient();
+ * 
+ * + *

View {@link FileClientBuilder this} for additional ways to construct the client.

+ * + * @see FileClientBuilder + * @see FileAsyncClient + * @see SharedKeyCredential + * @see SASTokenCredential + */ public class FileClient { - private final FileAsyncClient client; + private final FileAsyncClient fileAsyncClient; + + /** + * Creates a FileClient that wraps a FileAsyncClient and blocks requests. + * + * @param fileAsyncClient FileAsyncClient that is used to send requests + */ + FileClient(FileAsyncClient fileAsyncClient) { + this.fileAsyncClient = fileAsyncClient; + } + + /** + * Get the getFileUrl of the storage file client. + * @return the URL of the storage file client + * @throws MalformedURLException if no protocol is specified, or an + * unknown protocol is found, or {@code spec} is {@code null}. + */ + public URL getFileUrl() throws MalformedURLException { + return fileAsyncClient.getFileUrl(); + } + + /** + * Creates a file in the storage account and returns a response of {@link FileInfo} to interact with it. + * + *

Code Samples

+ * + *

Create the file with length of 1024 bytes, some headers and metadata.

+ * + * {@codesnippet com.azure.storage.file.fileClient.create} + * + * @param maxSize The maximum size in bytes for the file, up to 1 TiB. + * @return A response containing the file info and the status of creating the file. + * @throws StorageErrorException If the file has already existed, the parent directory does not exist or fileName is an invalid resource name. + */ + public Response create(long maxSize) { + return fileAsyncClient.create(maxSize).block(); + } + + /** + * Creates a file in the storage account and returns a response of FileInfo to interact with it. + * + *

Code Samples

+ * + *

Create the file with length of 1024 bytes, some headers and metadata.

+ * + *
+     * FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain");
+     * Response<FileInfo> response = client.create(1024, httpHeaders, Collections.singletonMap("file", "updatedMetadata"));
+     * System.out.printf("Creating the file completed with status code %d", response.statusCode());
+     * 
+ * + * @param maxSize The maximum size in bytes for the file, up to 1 TiB. + * @param httpHeaders Additional parameters for the operation. + * @param metadata Optional. Name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. + * @see C# identifiers + * @return A response containing the directory info and the status of creating the directory. + * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory is an invalid resource name. + */ + public Response create(long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { + return fileAsyncClient.create(maxSize, httpHeaders, metadata).block(); + } + + /** + * Copies a blob or file to a destination file within the storage account. + * + *

Code Samples

+ * + *

Copy file from source getDirectoryUrl to the {@code filePath}

+ * + * {@codesnippet com.azure.storage.file.fileClient.startCopy#string-map} + * + * @param sourceUrl Specifies the URL of the source file or blob, up to 2 KB in length. + * @param metadata Optional. Name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. + * * @see C# identifiers + * @return A response containing the file copy info and the status of copying the file. + */ + public Response startCopy(String sourceUrl, Map metadata) { + return fileAsyncClient.startCopy(sourceUrl, metadata).block(); + } + + /** + * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. + * + *

Code Samples

+ * + *

Abort copy file from copy id("someCopyId")

+ * + *
+     * VoidResponse response = client.abortCopy("someCopyId")
+     * System.out.printf("Abort copying the file completed with status code %d", response.statusCode());
+     * 
+ * + * @param copyId Specifies the copy id which has copying pending status associate with it. + * @return A response containing the status of aborting copy the file. + */ + public VoidResponse abortCopy(String copyId) { + return fileAsyncClient.abortCopy(copyId).block(); + } + + /** + * Downloads a file from the system, including its metadata and properties + * + *

Code Samples

+ * + *

Download the file to current folder.

+ * + * {@codesnippet com.azure.storage.file.fileClient.downloadToFile} + * + * @param downloadFilePath The path where store the downloaded file + */ + public void downloadToFile(String downloadFilePath) { + downloadToFile(downloadFilePath, null); + } + + /** + * Downloads a file from the system, including its metadata and properties + * + *

Code Samples

+ * + *

Download the file from 1024 to 2048 bytes to current folder.

+ * + *
+     * client.downloadToFile("someFilePath", new FileRange(1024, 2048));
+     * if (Files.exist(Paths.get(downloadFilePath))) {
+     *      System.out.println("Download the file completed");
+     * }
+     * 
+ * + * @param downloadFilePath The path where store the downloaded file + * @param range Optional. Return file data only from the specified byte range. + */ + public void downloadToFile(String downloadFilePath, FileRange range) { + fileAsyncClient.downloadToFile(downloadFilePath, range).block(); + } + + /** + * Downloads a file from the system, including its metadata and properties + * + *

Code Samples

+ * + *

Download the file with its metadata and properties.

+ * + * {@codesnippet com.azure.storage.file.fileClient.downloadWithProperties} + * + * @return A response that only contains headers and response status code + */ + public Response downloadWithProperties() { + return fileAsyncClient.downloadWithProperties(null, null).block(); + } - FileClient() { - throw new UnsupportedOperationException(); + /** + * Downloads a file from the system, including its metadata and properties + * + *

Code Samples

+ * + *

Download the file from 1024 to 2048 bytes with its metadata and properties and without the contentMD5.

+ * + *
+     * Response<FileDownloadInfo> response = client.downloadWithProperties()
+     * System.out.printf("Downloading the file completed with status code %d", response.statusCode());
+     * 
+ * + * @param range Optional. Return file data only from the specified byte range. + * @param rangeGetContentMD5 Optional. When this header is set to true and specified together with the Range header, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size. + * @return A response that only contains headers and response status code + */ + public Response downloadWithProperties(FileRange range, Boolean rangeGetContentMD5) { + return fileAsyncClient.downloadWithProperties(range, rangeGetContentMD5).block(); } - public static FileClientBuilder syncBuilder() { - throw new UnsupportedOperationException(); + /** + * Deletes the file associate with the client. + * + *

Code Samples

+ * + *

Delete the file

+ * + * {@codesnippet com.azure.storage.file.fileClient.delete} + * + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist. + */ + public VoidResponse delete() { + return fileAsyncClient.delete().block(); } - public Mono> create(long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { - throw new UnsupportedOperationException(); + /** + * Retrieves the properties of the storage account's file. + * The properties includes file metadata, last modified date, is server encrypted, and eTag. + * + *

Code Samples

+ * + *

Retrieve file properties

+ * + *
+     * Response<FileProperties> response = client.getProperties()
+     * DirectoryProperties properties = response.value();
+     * System.out.printf("File latest modified date is %s.", properties.lastModified());
+     * 
+ * + * @return Storage file properties + */ + public Response getProperties() { + return fileAsyncClient.getProperties().block(); } - public Mono> startCopy(String sourceUrl, Map metadata) { - throw new UnsupportedOperationException(); + /** + * Sets the user-defined httpHeaders to associate to the file. + * + *

If {@code null} is passed for the httpHeaders it will clear the httpHeaders associated to the file.

+ * + *

Code Samples

+ * + *

Set the httpHeaders of contentType of "text/plain"

+ * + *
+     * FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain");
+     * Response<FileInfo> response = client.setHttpHeaders(1024, httpHeaders);
+     * System.out.printf("Setting the file httpHeaders completed with status code %d", response.statusCode());
+     * 
+ * + *

Clear the metadata of the file

+ * + *
+     * Response<FileInfo> response = client.setHttpHeaders(1024, null)
+     * System.out.printf("Clearing the file httpHeaders completed with status code %d", response.statusCode());
+     * 
+ * + * @param newFileSize New file size of the file + * @param httpHeaders Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are cleared. + * @return Response of the information about the file + * @throws IllegalArgumentException thrown if parameters fail the validation. + */ + public Response setHttpHeaders(long newFileSize, FileHTTPHeaders httpHeaders) { + return fileAsyncClient.setHttpHeaders(newFileSize, httpHeaders).block(); } - public Mono abortCopy(String copyId) { - throw new UnsupportedOperationException(); + /** + * Sets the user-defined metadata to associate to the file. + * + *

If {@code null} is passed for the metadata it will clear the metadata associated to the file.

+ * + *

Code Samples

+ * + *

Set the metadata to "file:updatedMetadata"

+ * + *
+     * Response<FileMetadataInfo> response = client.setMetadata(Collections.singletonMap("file", "updatedMetadata"));
+     * System.out.printf("Setting the file metadata completed with status code %d", response.statusCode());
+     * 
+ * + *

Clear the metadata of the file

+ * + *
+     * client.setMetadata(null)
+     *     .subscribe(response -> System.out.printf("Clearing the file metadata completed with status code %d", response.statusCode()));
+     * 
+ * + * @param metadata Options.Metadata to set on the file, if null is passed the metadata for the file is cleared + * @return information about the file + * @throws StorageErrorException If the file doesn't exist or the metadata contains invalid keys + */ + public Response setMeatadata(Map metadata) { + return fileAsyncClient.setMetadata(metadata).block(); } - public Mono> downloadWithProperties(long offset, long length, boolean rangeGetContentMD5) { - throw new UnsupportedOperationException(); + /** + * Uploads a range of bytes to the beginning of a file in storage file service. Upload operations performs an in-place write on the specified file. + * + *

Code Samples

+ * + *

Upload "default" to the file.

+ * + * {@codesnippet com.azure.storage.file.fileClient.upload} + * + * @param data The data which will upload to the storage file. + * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero.. + * @return A response that only contains headers and response status code + * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) + */ + public Response upload(ByteBuf data, long length) { + return fileAsyncClient.upload(Flux.just(data), length).block(); } - public Mono delete() { - throw new UnsupportedOperationException(); + /** + * Uploads a range of bytes to specific of a file in storage file service. Upload operations performs an in-place write on the specified file. + * + *

Code Samples

+ * + *

Upload the file from 1024 to 2048 bytes with its metadata and properties and without the contentMD5.

+ * + *
+     * ByteBuf defaultData = Unpooled.wrappedBuffer("default".getBytes(StandardCharsets.UTF_8));
+     * Response<FileUploadInfo> response = client.upload(defaultData, defaultData.readableBytes());
+     * System.out.printf("Upload the bytes to file range completed with status code %d", response.statusCode());
+     * 
+ * + * @param data The data which will upload to the storage file. + * @param offset Optional. The starting point of the upload range. It will start from the beginning if it is {@code null} + * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero. + * @param type You may specify one of the following options: + * - Update: Writes the bytes specified by the request body into the specified range. + * - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero. + * @return A response that only contains headers and response status code + * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) + */ + public Response upload(ByteBuf data, long length, int offset, FileRangeWriteType type) { + return fileAsyncClient.upload(Flux.just(data), length, offset, type).block(); } - public Mono> getProperties(String shareSnapshot) { - throw new UnsupportedOperationException(); + /** + * Uploads file to storage file service. + * + *

Code Samples

+ * + *

Upload the file from the source file path.

+ * + * {@codesnippet com.azure.storage.file.fileClient.uploadFromFile} + * + * @param uploadFilePath The path where store the source file to upload + */ + public void uploadFromFile(String uploadFilePath) { + uploadFromFile(uploadFilePath, FileRangeWriteType.UPDATE); } - public Mono> setHttpHeaders(long newFileSize, FileHTTPHeaders httpHeaders) { - throw new UnsupportedOperationException(); + /** + * Uploads file to storage file service. + * + *

Code Samples

+ * + *

Upload the file from the source file path.

+ * + *
+     * client.uploadFromFile("someFilePath", FileRangeWriteType.UPDATE);
+     * if (client.getProperties() != null) {
+     *     System.out.printf("Upload the file with length of %d completed", client.getProperties().block().value().contentLength());
+     * };
+     * 
+ * + * @param uploadFilePath The path where store the source file to upload + * @param type You may specify one of the following options: + * - Update: Writes the bytes specified by the request body into the specified range. + * - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero. + */ + public void uploadFromFile(String uploadFilePath, FileRangeWriteType type) { + fileAsyncClient.uploadFromFile(uploadFilePath, type).block(); } - public Mono> setMeatadata(Map meatadata) { - throw new UnsupportedOperationException(); + /** + * List of valid ranges for a file. + * + *

Code Samples

+ * + *

List all ranges for the file client.

+ * + *
+     * Iterable<FileRange> ranges = client.listRanges();
+     * ranges.forEach(range ->
+     *      System.out.printf("List ranges completed with start: %d, end: %d", range.start(), range.end()));
+     * 
+ * + * @return {@link FileRange ranges} in the files. + */ + public Iterable listRanges() { + return fileAsyncClient.listRanges(null).toIterable(); } - public Mono> upload(FileRangeWriteType type, long offset, long length, Flux data) { - throw new UnsupportedOperationException(); + /** + * List of valid ranges for a file. + * + *

Code Samples

+ * + *

List all ranges within the file range from 1KB to 2KB.

+ * + *
+     * Iterable%lt;FileRange> ranges = client.listRanges(new FileRange(1024, 2048));
+     * ranges.forEach(range ->
+     *      System.out.printf("List ranges completed with start: %d, end: %d", range.start(), range.end()));
+     * 
+ * + * @param range Optional. Return file data only from the specified byte range. + * @return {@link FileRange ranges} in the files that satisfy the requirements + */ + public Iterable listRanges(FileRange range) { + return fileAsyncClient.listRanges(range).toIterable(); } - public Flux listRanges(long offset, long length, String shareSnapshot) { - throw new UnsupportedOperationException(); + /** + * List of open handles on a file. + * + *

Code Samples

+ * + *

List all handles for the file client.

+ * + *
+     * client.listHandles()
+     *     .forEach(handleItem -> System.out.printf("List handles completed with handleId %d", handleItem.handleId()));
+     * 
+ * + * @return {@link HandleItem handles} in the files that satisfy the requirements + */ + public Iterable listHandles() { + return listHandles(null); } - public Flux listHandles(int maxResults) { - throw new UnsupportedOperationException(); + /** + * List of open handles on a file. + * + *

Code Samples

+ * + *

List 10 handles for the file client.

+ * + *
+     * client.listHandles(10)
+     *     .forEach(handleItem -> System.out.printf("List handles completed with handleId %d", handleItem.handleId()));
+     * 
+ * @param maxResults Optional. The number of results will return per page + * @return {@link HandleItem handles} in the file that satisfy the requirements + */ + public Iterable listHandles(Integer maxResults) { + return fileAsyncClient.listHandles(maxResults).toIterable(); } - public Flux forceCloseHandles(String handleId) { - throw new UnsupportedOperationException(); + /** + * Closes a handle or handles opened on a file at the service. It is intended to be used alongside {@link FileClient#listHandles()} (Integer)} . + * + *

Code Samples

+ * + *

Force close handles with handles returned by list handles in recursive.

+ * + *
+     * client.listHandles(10)
+     *     .forEach(result -> {
+     *         client.forceCloseHandles(result.handleId(), true).subscribe(numOfClosedHandles ->
+     *              System.out.printf("Close %d handles.", numOfClosedHandles)
+     *     )});
+     * 
+ * @param handleId Specifies the handle ID to be closed. Use an asterisk ('*') as a wildcard string to specify all handles. + * @return The counts of number of handles closed + */ + public Iterable forceCloseHandles(String handleId) { + return fileAsyncClient.forceCloseHandles(handleId).toIterable(); } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/FileClientBuilder.java b/storage/client/file/src/main/java/com/azure/storage/file/FileClientBuilder.java index 610466b2aed52..f0c01d03ff4b4 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/FileClientBuilder.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/FileClientBuilder.java @@ -3,7 +3,357 @@ package com.azure.storage.file; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; +import com.azure.core.util.configuration.Configuration; +import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.common.policy.SASTokenCredentialPolicy; +import com.azure.storage.common.policy.SharedKeyCredentialPolicy; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link FileClient FileClients} + * and {@link FileAsyncClient FileAsyncClients}, calling {@link FileClientBuilder#buildClient() buildClient} + * constructs an instance of FileClient and calling {@link FileClientBuilder#buildAsyncClient() buildAsyncClient} + * constructs an instance of FileAsyncClient. + * + *

The client needs the endpoint of the Azure Storage File service, name of the share, and authorization credential. + * {@link FileClientBuilder#endpoint(String) endpoint} gives the builder the endpoint and may give the builder the + * {@link FileClientBuilder#shareName(String)}, {@link FileClientBuilder#filePath(String)} and a {@link SASTokenCredential} that authorizes the client.

+ * + *

Instantiating a synchronous File Client with SAS token

+ * {@codesnippet com.azure.storage.file.fileClient.instantiation.sastoken} + * + *

Instantiating an Asynchronous File Client with SAS token

+ * {@codesnippet com.azure.storage.file.directoryClient.instantiation.sastoken} + * + *

If the {@code endpoint} doesn't contain the query parameters to construct a {@code SASTokenCredential} they may + * be set using {@link FileClientBuilder#credential(SASTokenCredential) credential}.

+ * + *
+ * FileClient client = FileClient.builder()
+ *     .endpoint(endpointWithoutSASTokenQueryParams)
+ *     .shareName(shareName)
+ *     .filePath(filePath)
+ *     .credential(SASTokenCredential.fromQuery(SASTokenQueryParams))
+ *     .buildClient();
+ * 
+ * + *
+ * FileAsyncClient client = FileAsyncClient.builder()
+ *     .endpoint(endpointWithoutSASTokenQueryParams)
+ *     .shareName(shareName)
+ *     .filePath(filePath)
+ *     .credential(SASTokenCredential.fromQuery(SASTokenQueryParams))
+ *     .buildAsyncClient();
+ * 
+ * + *

Another way to authenticate the client is using a {@link SharedKeyCredential}. To create a SharedKeyCredential + * a connection string from the Storage File service must be used. Set the SharedKeyCredential with + * {@link FileClientBuilder#connectionString(String) connectionString}. If the builder has both a SASTokenCredential and + * SharedKeyCredential the SharedKeyCredential will be preferred when authorizing requests sent to the service.

+ * + *

Instantiating a synchronous File Client with connection string.

+ * {@codesnippet com.azure.storage.file.directoryClient.instantiation.connectionstring} + * + *

Instantiating an Asynchronous File Client with connection string.

+ * {@codesnippet com.azure.storage.file.directoryAsyncClient.instantiation.connectionstring} + * + * @see FileClient + * @see FileAsyncClient + * @see SASTokenCredential + * @see SharedKeyCredential + */ public class FileClientBuilder { + private static final String ACCOUNT_NAME = "AccountName".toLowerCase(); + private final List policies; + private final RetryPolicy retryPolicy; + + private HttpLogDetailLevel logLevel; + private Configuration configuration; + private URL endpoint; + private String shareName; + private String filePath; + private SASTokenCredential sasTokenCredential; + private SharedKeyCredential sharedKeyCredential; + private HttpClient httpClient; + private HttpPipeline pipeline; + private String shareSnapshot; + + /** + * Creates a builder instance that is able to configure and construct {@link FileClient FileClients} + * and {@link FileAsyncClient FileAsyncClients}. + */ + public FileClientBuilder() { + retryPolicy = new RetryPolicy(); + logLevel = HttpLogDetailLevel.NONE; + policies = new ArrayList<>(); + + configuration = ConfigurationManager.getConfiguration(); + } + + /** + * Creates a {@link FileAsyncClient} based on options set in the builder. Every time {@code buildAsyncClient()} is + * called a new instance of {@link FileAsyncClient} is created. + * + *

+ * If {@link FileClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and + * {@link FileClientBuilder#endpoint(String) endpoint} are used to create the + * {@link FileAsyncClient client}. All other builder settings are ignored. + *

+ * + * @return A ShareAsyncClient with the options set from the builder. + * @throws NullPointerException If {@code endpoint} or {@code shareName} is {@code null}. + * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. + */ + public FileAsyncClient buildAsyncClient() { + Objects.requireNonNull(endpoint); + + if (sasTokenCredential == null && sharedKeyCredential == null) { + throw new IllegalArgumentException("Credentials are required for authorization"); + } + + // Closest to API goes first, closest to wire goes last. + final List policies = new ArrayList<>(); + + policies.add(new UserAgentPolicy(FileConfiguration.NAME, FileConfiguration.VERSION, configuration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddDatePolicy()); + + if (sharedKeyCredential != null) { + policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); + } else { + policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); + } + + HttpPolicyProviders.addBeforeRetryPolicies(policies); + + policies.add(retryPolicy); + + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(logLevel)); + + HttpPipeline pipeline = HttpPipeline.builder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .build(); + + return new FileAsyncClient(endpoint, pipeline, shareName, filePath, shareSnapshot); + } + + /** + * Creates a {@link FileClient} based on options set in the builder. Every time {@code buildClient()} is + * called a new instance of {@link FileClient} is created. + * + *

+ * If {@link FileClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and + * {@link FileClientBuilder#endpoint(String) endpoint} are used to create the + * {@link FileClient client}. All other builder settings are ignored. + *

+ * + * @return A FileClient with the options set from the builder. + * @throws NullPointerException If {@code endpoint}, {@code shareName} or {@code filePath} is {@code null}. + * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. + */ + public FileClient buildClient() { + return new FileClient(this.buildAsyncClient()); + } + + /** + * Sets the endpoint for the Azure Storage File instance that the client will interact with. + * + *

The first path segment, if the endpoint contains path segments, will be assumed to be the name of the share + * that the client will interact with. Rest of the path segments should be the path of the file. + * It mush end up with the file name if more segments exist.

+ * + *

Query parameters of the endpoint will be parsed using {@link SASTokenCredential#fromQuery(String)} in an + * attempt to generate a {@link SASTokenCredential} to authenticate requests sent to the service.

+ * + * @param endpoint The URL of the Azure Storage File instance to send service requests to and receive responses from. + * @return the updated FileClientBuilder object + * @throws IllegalArgumentException If {@code endpoint} is {@code null} or is an invalid URL + */ + public FileClientBuilder endpoint(String endpoint) { + Objects.requireNonNull(endpoint); + try { + URL fullURL = new URL(endpoint); + this.endpoint = new URL(fullURL.getProtocol() + "://" + fullURL.getHost()); + + // Attempt to get the share name and file path from the URL passed + String[] pathSegments = fullURL.getPath().split("/"); + int length = pathSegments.length; + this.shareName = length >= 2 ? pathSegments[1] : this.shareName; + String[] filePathParams = length >= 3 ? Arrays.copyOfRange(pathSegments, 2, length) : null; + this.filePath = filePathParams != null ? String.join("/", filePathParams) : this.filePath; + + // Attempt to get the SAS token from the URL passed + SASTokenCredential credential = SASTokenCredential.fromQuery(fullURL.getQuery()); + if (credential != null) { + this.sasTokenCredential = credential; + } + } catch (MalformedURLException ex) { + throw new IllegalArgumentException("The Azure Storage File endpoint url is malformed."); + } + + return this; + } + + /** + * Sets the {@link SASTokenCredential} used to authenticate requests sent to the File service. + * + * @param credential SAS token credential generated from the Storage account that authorizes requests + * @return the updated FileClientBuilder object + * @throws NullPointerException If {@code credential} is {@code null}. + */ + public FileClientBuilder credential(SASTokenCredential credential) { + this.sasTokenCredential = credential; + return this; + } + + /** + * Creates a {@link SharedKeyCredential} from the {@code connectionString} used to authenticate requests sent to the + * File service. + * + * @param connectionString Connection string from the Access Keys section in the Storage account + * @return the updated FileClientBuilder object + * @throws NullPointerException If {@code connectionString} is {@code null}. + */ + public FileClientBuilder connectionString(String connectionString) { + Objects.requireNonNull(connectionString); + this.sharedKeyCredential = SharedKeyCredential.fromConnectionString(connectionString); + getEndPointFromConnectionString(connectionString); + return this; + } + + private void getEndPointFromConnectionString(String connectionString) { + Map connectionStringPieces = new HashMap<>(); + for (String connectionStringPiece : connectionString.split(";")) { + String[] kvp = connectionStringPiece.split("=", 2); + connectionStringPieces.put(kvp[0].toLowerCase(), kvp[1]); + } + String accountName = connectionStringPieces.get(ACCOUNT_NAME); + try { + this.endpoint = new URL(String.format("https://%s.file.core.windows.net", accountName)); + } catch (MalformedURLException e) { + throw new IllegalArgumentException(String.format("There is no valid endpoint for the connection string. " + + "Connection String: %s", connectionString)); + } + } + + /** + * Sets the share that the constructed clients will interact with + * + * @param shareName Name of the share + * @return the updated FileClientBuilder object + * @throws NullPointerException If {@code shareName} is {@code null}. + */ + public FileClientBuilder shareName (String shareName) { + this.shareName = shareName; + return this; + } + + /** + * Sets the file that the constructed clients will interact with + * + * @param filePath Path of the file, mush end up with the file name. + * @return the updated FileClientBuilder object + * @throws NullPointerException If {@code filePath} is {@code null}. + */ + public FileClientBuilder filePath(String filePath) { + this.filePath = filePath; + return this; + } + + /** + * Sets the HTTP client to use for sending and receiving requests to and from the service. + * + * @param httpClient The HTTP client to use for requests. + * @return The updated FileClientBuilder object. + * @throws NullPointerException If {@code httpClient} is {@code null}. + */ + public FileClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /** + * Adds a policy to the set of existing policies that are executed after the {@link RetryPolicy}. + * + * @param pipelinePolicy The retry policy for service requests. + * @return The updated FileClientBuilder object. + * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. + */ + public FileClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { + this.policies.add(pipelinePolicy); + return this; + } + + /** + * Sets the logging level for HTTP requests and responses. + * + * @param logLevel The amount of logging output when sending and receiving HTTP requests/responses. + * @return The updated FileClientBuilder object. + */ + public FileClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { + this.logLevel = logLevel; + return this; + } + + /** + * Sets the HTTP pipeline to use for the service client. + * + *

If {@code pipeline} is set, all other settings are ignored, aside from {@link FileClientBuilder#endpoint(String) endpoint}, + * {@link FileClientBuilder#shareName(String) shareName} @{link FileClientBuilder#filePath(String) filePath}, and {@link FileClientBuilder#shareSnapshot(String) snaphotShot} + * when building clients.

+ * + * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. + * @return The updated FileClientBuilder object. + * @throws NullPointerException If {@code pipeline} is {@code null}. + */ + public FileClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = Objects.requireNonNull(pipeline); + return this; + } + + /** + * Sets the configuration object used to retrieve environment configuration values used to buildClient the client with + * when they are not set in the builder, defaults to Configuration.NONE + * @param configuration configuration store + * @return the updated FileClientBuilder object + */ + public FileClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } - // fileUri, SharedKeyCredential, FileClientOptions ,withSnapshot + /** + * Sets the snapshot that the constructed clients will interact with. This snapshot must be linked to the share + * that has been specified in the builder. + * + * @param shareSnapshot Identifier of the snapshot + * @return the updated FileClientBuilder object + * @throws NullPointerException If {@code shareSnapshot} is {@code null}. + */ + public FileClientBuilder shareSnapshot(String shareSnapshot) { + this.shareSnapshot = shareSnapshot; + return this; + } } diff --git a/storage/client/src/main/java/com/azure/storage/file/FileConfiguration.java b/storage/client/file/src/main/java/com/azure/storage/file/FileConfiguration.java similarity index 100% rename from storage/client/src/main/java/com/azure/storage/file/FileConfiguration.java rename to storage/client/file/src/main/java/com/azure/storage/file/FileConfiguration.java diff --git a/storage/client/file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java b/storage/client/file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java index 9c66716ca61c0..6bc2e7049274a 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java @@ -3,51 +3,362 @@ package com.azure.storage.file; +import com.azure.core.http.HttpPipeline; import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.util.ImplUtils; +import com.azure.core.util.Context; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.file.implementation.AzureFileStorageBuilder; +import com.azure.storage.file.implementation.AzureFileStorageImpl; +import com.azure.storage.file.models.CorsRule; +import com.azure.storage.file.models.DeleteSnapshotsOptionType; import com.azure.storage.file.models.FileServiceProperties; +import com.azure.storage.file.models.ListSharesIncludeType; import com.azure.storage.file.models.ListSharesOptions; +import com.azure.storage.file.models.ListSharesResponse; +import com.azure.storage.file.models.ServicesListSharesSegmentResponse; import com.azure.storage.file.models.ShareItem; +import com.azure.storage.file.models.StorageErrorException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import org.reactivestreams.Publisher; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -import java.util.Map; - -public class FileServiceAsyncClient { +/** + * This class provides a client that contains all the operations for interacting with a file account in Azure Storage. + * Operations allowed by the client are creating, listing, and deleting shares and retrieving and updating properties + * of the account. + * + *

Instantiating an Asynchronous File Service Client

+ * + *
+ * FileServiceAsyncClient client = FileServiceAsyncClient.builder()
+ *     .connectionString(connectionString)
+ *     .endpoint(endpoint)
+ *     .buildAsyncClient();
+ * 
+ * + *

View {@link FileServiceClientBuilder this} for additional ways to construct the client.

+ * + * @see FileServiceClientBuilder + * @see FileServiceClient + * @see SharedKeyCredential + * @see SASTokenCredential + */ +public final class FileServiceAsyncClient { + private final AzureFileStorageImpl client; - FileServiceAsyncClient() { - throw new UnsupportedOperationException(); + /** + * Creates a FileServiceClient that sends requests to the storage account at {@code endpoint}. + * Each service call goes through the {@code httpPipeline}. + * + * @param endpoint URL for the Storage File service + * @param httpPipeline HttpPipeline that the HTTP requests and responses flow through + */ + FileServiceAsyncClient(URL endpoint, HttpPipeline httpPipeline) { + this.client = new AzureFileStorageBuilder().pipeline(httpPipeline) + .url(endpoint.toString()) + .build(); } - public static FileServiceClientBuilder asyncBuilder() { - throw new UnsupportedOperationException(); + /** + * @return the getFileServiceUrl of the Storage File service + */ + public String getFileServiceUrl() { + return client.url(); } - public String url() { - throw new UnsupportedOperationException(); + /** + * Constructs a ShareAsyncClient that interacts with the specified share. + * + *

If the share doesn't exist in the storage account {@link ShareAsyncClient#create() create} in the client will + * need to be called before interaction with the share can happen.

+ * + * @param shareName Name of the share + * @return a ShareAsyncClient that interacts with the specified share + */ + public ShareAsyncClient getShareAsyncClient(String shareName) { + return new ShareAsyncClient(client, shareName); } - public ShareAsyncClient getShareClient(String shareName) { - throw new UnsupportedOperationException(); + /** + * Lists all shares in the storage account without their metadata or snapshots. + * + *

Code Samples

+ * + *

List all shares in the account

+ * + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.listShares} + * + * @return {@link ShareItem Shares} in the storage account without their metadata or snapshots + */ + public Flux listShares() { + return listShares(null); } + /** + * Lists the shares in the Storage account that pass the options filter. + * + *

Set starts with name filter using {@link ListSharesOptions#prefix(String) prefix} to filter shares that are + * listed.

+ * + *

Pass true to {@link ListSharesOptions#includeMetadata(boolean) includeMetadata} to have metadata returned for + * the shares.

+ * + *

Pass true to {@link ListSharesOptions#includeSnapshots(boolean) includeSnapshots} to have snapshots of the + * shares listed.

+ * + *

Code Samples

+ * + *

List all shares that begin with "azure"

+ * + *
+     * client.listShares(new ListSharesOptions().prefix("azure"))
+     *     .subscribe(result -> System.out.printf("Share %s exists in the account", result.name()));
+     * 
+ * + *

List all shares including their snapshots and metadata

+ * + *
+     * client.listShares(new ListSharesOptions().includeMetadata(true).includeSnapshots(true))
+     *     .subscribe(result -> System.out.printf("Share %s, Is Snapshot? %b, Metadata: %s", result.name(), result.snapshot() != null, result.metadata()));
+     * 
+ * + * @param options Options for listing shares + * @return {@link ShareItem Shares} in the storage account that satisfy the filter requirements + */ public Flux listShares(ListSharesOptions options) { - throw new UnsupportedOperationException(); + return listShares(null, options); + } + + /** + * Lists the shares in the storage account that pass the filter starting at the specified marker. + * + * @param marker Starting point to list the shares + * @param options Options for listing shares + * @return {@link ShareItem Shares} in the storage account that satisfy the filter requirements + */ + private Flux listShares(String marker, ListSharesOptions options) { + String prefix = null; + Integer maxResults = null; + List include = new ArrayList<>(); + + if (options != null) { + prefix = options.prefix(); + maxResults = options.maxResults(); + + if (options.includeMetadata()) { + include.add(ListSharesIncludeType.fromString(ListSharesIncludeType.METADATA.toString())); + } + + if (options.includeSnapshots()) { + include.add(ListSharesIncludeType.fromString(ListSharesIncludeType.SNAPSHOTS.toString())); + } + } + + return client.services().listSharesSegmentWithRestResponseAsync(prefix, marker, maxResults, include, null, Context.NONE) + .flatMapMany(response -> Flux.fromIterable(response.value().shareItems())); + } + + /* + * Helper function used to auto-enumerate through paged responses + */ + private Flux listShares(ServicesListSharesSegmentResponse response, List include, Context context) { + ListSharesResponse value = response.value(); + Mono result = client.services() + .listSharesSegmentWithRestResponseAsync(value.prefix(), value.marker(), value.maxResults(), include, null, context); + + return result.flatMapMany(r -> extractAndFetchShares(r, include, context)); + } + + /* + * Helper function used to auto-enumerate through paged responses + */ + private Publisher extractAndFetchShares(ServicesListSharesSegmentResponse response, List include, Context context) { + String nextPageLink = response.value().nextMarker(); + if (ImplUtils.isNullOrEmpty(nextPageLink)) { + return Flux.fromIterable(response.value().shareItems()); + } + + return Flux.fromIterable(response.value().shareItems()).concatWith(listShares(response, include, context)); } + /** + * Retrieves the properties of the storage account's File service. The properties range from storage analytics and + * metrics to CORS (Cross-Origin Resource Sharing). + * + *

Code Samples

+ * + *

Retrieve File service properties

+ * + *
+     * client.getProperties()
+     *    .subscribe(response -> {
+     *        FileServiceProperties properties = response.value();
+     *        System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", properties.hourMetrics().enabled(), properties.minuteMetrics().enabled());
+     *    });
+     * 
+ * + * @return Storage account File service properties + */ public Mono> getProperties() { - throw new UnsupportedOperationException(); + return client.services().getPropertiesWithRestResponseAsync(Context.NONE) + .map(response -> mapToResponse(response, response.value())); } - public Mono setProperties() { - throw new UnsupportedOperationException(); + /** + * Sets the properties for the storage account's File service. The properties range from storage analytics and + * metric to CORS (Cross-Origin Resource Sharing). + * + * To maintain the CORS in the Queue service pass a {@code null} value for {@link FileServiceProperties#cors() CORS}. + * To disable all CORS in the Queue service pass an empty list for {@link FileServiceProperties#cors() CORS}. + * + *

Code Sample

+ * + *

Clear CORS in the File service

+ * + *
+     * FileServiceProperties properties = client.getProperties().block().value();
+     * properties.cors(Collections.emptyList());
+     *
+     * client.setProperties(properties)
+     *     .subscribe(response -> System.out.printf("Setting File service properties completed with status code %d", response.statusCode()));
+     * 
+ * + *

Enable Minute and Hour Metrics

+ * + *
+     * FileServiceProperties properties = client.getProperties().block().value();
+     * properties.minuteMetrics().enabled(true);
+     * properties.hourMetrics().enabled(true);
+     *
+     * client.setProperties(properties)
+     *     .subscribe(response -> System.out.printf("Setting File service properties completed with status code %d", response.statusCode()));
+     * 
+ * + * @param properties Storage account File service properties + * @return A response that only contains headers and response status code + * @throws StorageErrorException When one of the following is true + *
    + *
  • A CORS rule is missing one of its fields
  • + *
  • More than five CORS rules will exist for the Queue service
  • + *
  • Size of all CORS rules exceeds 2KB
  • + *
  • + * Length of {@link CorsRule#allowedHeaders() allowed headers}, {@link CorsRule#exposedHeaders() exposed headers}, + * or {@link CorsRule#allowedOrigins() allowed origins} exceeds 256 characters. + *
  • + *
  • {@link CorsRule#allowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or PUT
  • + *
+ */ + public Mono setProperties(FileServiceProperties properties) { + return client.services().setPropertiesWithRestResponseAsync(properties, Context.NONE) + .map(VoidResponse::new); } - public Mono> createShare(String shareName, Map metadata, int quotaInGB) { - throw new UnsupportedOperationException(); + /** + * Creates a share in the storage account with the specified name and returns a ShareAsyncClient to interact with it. + * + *

Code Samples

+ * + *

Create the share "test"

+ * + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.createShare#string} + * + * @param shareName Name of the share + * @return A response containing the ShareAsyncClient and the status of creating the share. + * @throws StorageErrorException If a share with the same name already exists + */ + public Mono> createShare(String shareName) { + return createShare(shareName, null, null); } + /** + * Creates a share in the storage account with the specified name, metadata, and quota and returns a ShareAsyncClient to + * interact with it. + * + *

Code Samples

+ * + *

Create the share "test" with metadata "share:metadata"

+ * + *
+     * client.createShare("test", Collections.singletonMap("share", "metadata"), null)
+     *     .subscribe(response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()));
+     * 
+ * + *

Create the share "test" with a quota of 10 GB

+ * + *
+     * client.createShare("test", null, 10)
+     *     .subscribe(response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()));
+     * 
+ * + * @param shareName Name of the share + * @param metadata Optional. Metadata to associate with the share + * @param quotaInGB Optional. Maximum size the share is allowed to grow to in GB. This must be greater than 0 and + * less than or equal to 5120. The default value is 5120. + * @return A response containing the ShareAsyncClient and the status of creating the share. + * @throws StorageErrorException If a share with the same name already exists or {@code quotaInGB} is outside the + * allowed range. + */ + public Mono> createShare(String shareName, Map metadata, Integer quotaInGB) { + ShareAsyncClient shareAsyncClient = new ShareAsyncClient(client, shareName); + + return shareAsyncClient.create(metadata, quotaInGB) + .map(response -> mapToResponse(response, shareAsyncClient)); + } + + /** + * Deletes the share in the storage account with the given name + * + *

Code Samples

+ * + *

Delete the share "test"

+ * + * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.deleteShare#string} + * + * @param shareName Name of the share + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the share doesn't exist + */ + public Mono deleteShare(String shareName) { + return deleteShare(shareName, null); + } + + /** + * Deletes the specific snapshot of the share in the storage account with the given name. Snapshot are identified + * by the time they were created. + * + *

Code Samples

+ * + *

Delete the snapshot of share "test" that was created at midnight

+ * + *
+     * OffsetDateTime midnight = OffsetDateTime.of(LocalTime.MIDNIGHT, ZoneOffset.UTC));
+     * client.deleteShare("test", midnight.toString())
+     *     .subscribe(response -> System.out.printf("Deleting the snapshot completed with status code %d", response.statusCode()));
+     * 
+ * + * @param shareName Name of the share + * @param shareSnapshot Identifier of the snapshot + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the share doesn't exist or the snapshot doesn't exist + */ public Mono deleteShare(String shareName, String shareSnapshot) { - throw new UnsupportedOperationException(); + DeleteSnapshotsOptionType deleteSnapshots = null; + if (ImplUtils.isNullOrEmpty(shareSnapshot)) { + deleteSnapshots = DeleteSnapshotsOptionType.fromString(DeleteSnapshotsOptionType.INCLUDE.toString()); + } + return client.shares().deleteWithRestResponseAsync(shareName, shareSnapshot, null, deleteSnapshots, Context.NONE) + .map(VoidResponse::new); + } + + static Response mapToResponse(Response response, T value) { + return new SimpleResponse<>(response.request(), response.statusCode(), response.headers(), value); } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/FileServiceClient.java b/storage/client/file/src/main/java/com/azure/storage/file/FileServiceClient.java index fd808bf1d6fde..34b49ab05dadc 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/FileServiceClient.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/FileServiceClient.java @@ -1,52 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + package com.azure.storage.file; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.VoidResponse; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.file.models.CorsRule; import com.azure.storage.file.models.FileServiceProperties; import com.azure.storage.file.models.ListSharesOptions; import com.azure.storage.file.models.ShareItem; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - +import com.azure.storage.file.models.StorageErrorException; import java.util.Map; -public class FileServiceClient { - +/** + * This class provides a client that contains all the operations for interacting with a file account in Azure Storage. + * Operations allowed by the client are creating, listing, and deleting shares and retrieving and updating properties + * of the account. + * + *

Instantiating a Synchronous File Service Client

+ * + *
+ * FileServiceClient client = FileServiceClient.builder()
+ *     .connectionString(connectionString)
+ *     .endpoint(endpoint)
+ *     .buildClient();
+ * 
+ * + *

View {@link FileServiceClientBuilder this} for additional ways to construct the client.

+ * + * @see FileServiceClientBuilder + * @see FileServiceAsyncClient + * @see SharedKeyCredential + * @see SASTokenCredential + */ +public final class FileServiceClient { private final FileServiceAsyncClient client; - FileServiceClient() { - throw new UnsupportedOperationException(); + /** + * Creates a FileServiceClient that wraps a FileServiceAsyncClient and blocks requests. + * + * @param client FileServiceAsyncClient that is used to send requests + */ + FileServiceClient(FileServiceAsyncClient client) { + this.client = client; } - public static FileServiceClientBuilder syncBuilder() { - throw new UnsupportedOperationException(); + /** + * @return the getFileServiceUrl of the Storage File service + */ + public String getFileServiceUrl() { + return client.getFileServiceUrl(); } - public String url() { - throw new UnsupportedOperationException(); + /** + * Constructs a ShareClient that interacts with the specified share. + * + *

If the share doesn't exist in the storage account {@link ShareClient#create() create} in the client will + * need to be called before interaction with the share can happen.

+ * + * @param shareName Name of the share + * @return a ShareClient that interacts with the specified share + */ + public ShareClient getShareClient(String shareName) { + return new ShareClient(client.getShareAsyncClient(shareName)); } - public ShareClient getShareClient(String shareName) { - throw new UnsupportedOperationException(); + /** + * Lists all shares in the storage account without their metadata or snapshots. + * + *

Code Samples

+ * + *

List all shares in the account

+ * + * {@codesnippet com.azure.storage.file.fileServiceClient.listShares} + * + * @return {@link ShareItem Shares} in the storage account without their metadata or snapshots + */ + public Iterable listShares() { + return listShares(null); + } + + /** + * Lists the shares in the Storage account that pass the options filter. + * + *

Set starts with name filter using {@link ListSharesOptions#prefix(String) prefix} to filter shares that are + * listed.

+ * + *

Pass true to {@link ListSharesOptions#includeMetadata(boolean) includeMetadata} to have metadata returned for + * the shares.

+ * + *

Pass true to {@link ListSharesOptions#includeSnapshots(boolean) includeSnapshots} to have snapshots of the + * shares listed.

+ * + *

Code Samples

+ * + *

List all shares that begin with "azure"

+ * + *
+     * for (ShareItem result : client.listShares(new ListSharesOptions().prefix("azure"))) {
+     *     System.out.printf("Share %s exists in the account", result.name());
+     * }
+     * 
+ * + *

List all shares including their snapshots and metadata

+ * + *
+     * for (ShareItem result : client.listShares(new ListSharesOptions().includeMetadata(true).includeSnapshots(true))) {
+     *     System.out.printf("Share %s, Is Snapshot? %b, Metadata: %s", result.name(), result.snapshot() != null, result.metadata());
+     * }
+     * 
+ * + * @param options Options for listing shares + * @return {@link ShareItem Shares} in the storage account that satisfy the filter requirements + */ + public Iterable listShares(ListSharesOptions options) { + return client.listShares(options).toIterable(); + } + + /** + * Retrieves the properties of the storage account's File service. The properties range from storage analytics and + * metrics to CORS (Cross-Origin Resource Sharing). + * + *

Code Samples

+ * + *

Retrieve File service properties

+ * + *
+     * FileServiceProperties properties = client.getProperties().value();
+     * System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", properties.hourMetrics().enabled(), properties.minuteMetrics().enabled());
+     * 
+ * + * @return Storage account File service properties + */ + public Response getProperties() { + return client.getProperties().block(); } - public Flux listShares(ListSharesOptions options) { - throw new UnsupportedOperationException(); + /** + * Sets the properties for the storage account's File service. The properties range from storage analytics and + * metric to CORS (Cross-Origin Resource Sharing). + * + * To maintain the CORS in the Queue service pass a {@code null} value for {@link FileServiceProperties#cors() CORS}. + * To disable all CORS in the Queue service pass an empty list for {@link FileServiceProperties#cors() CORS}. + * + *

Code Sample

+ * + *

Clear CORS in the File service

+ * + *
+     * FileServiceProperties properties = client.getProperties().value();
+     * properties.cors(Collections.emptyList());
+     *
+     * VoidResponse response = client.setProperties(properties);
+     * System.out.printf("Setting File service properties completed with status code %d", response.statusCode());
+     * 
+ * + *

Enable Minute and Hour Metrics

+ * + *
+     * FileServiceProperties properties = client.getProperties().value();
+     * properties.minuteMetrics().enabled(true);
+     * properties.hourMetrics().enabled(true);
+     *
+     * VoidResponse respone = client.setProperties(properties);
+     * System.out.printf("Setting File service properties completed with status code %d", response.statusCode());
+     * 
+ * + * @param properties Storage account File service properties + * @return A response that only contains headers and response status code + * @throws StorageErrorException When one of the following is true + *
    + *
  • A CORS rule is missing one of its fields
  • + *
  • More than five CORS rules will exist for the Queue service
  • + *
  • Size of all CORS rules exceeds 2KB
  • + *
  • + * Length of {@link CorsRule#allowedHeaders() allowed headers}, {@link CorsRule#exposedHeaders() exposed headers}, + * or {@link CorsRule#allowedOrigins() allowed origins} exceeds 256 characters. + *
  • + *
  • {@link CorsRule#allowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or PUT
  • + *
+ */ + public VoidResponse setProperties(FileServiceProperties properties) { + properties = new FileServiceProperties(); + return client.setProperties(properties).block(); } - public Mono> getProperties() { - throw new UnsupportedOperationException(); + /** + * Creates a share in the storage account with the specified name and returns a ShareClient to interact with it. + * + *

Code Samples

+ * + *

Create the share with share name of "myshare"

+ * {@codesnippet com.azure.storage.file.fileServiceClient.createShare#string} + * + * @param shareName Name of the share + * @return A response containing the ShareClient and the status of creating the share. + * @throws StorageErrorException If a share with the same name already exists + */ + public Response createShare(String shareName) { + return createShare(shareName, null, null); } - public Mono setProperties() { - throw new UnsupportedOperationException(); + /** + * Creates a share in the storage account with the specified name and metadata and returns a ShareClient to + * interact with it. + * + *

Code Samples

+ * + *

Create the share "test" with metadata "share:metadata"

+ * + *
+     * Response<ShareClient> response = client.createShare("test", Collections.singletonMap("share", "metadata"), null);
+     * System.out.printf("Creating the share completed with status code %d", response.statusCode());
+     * 
+ * + *

Create the share "test" with a quota of 10 GB

+ * + *
+     * Response<ShareClient> response = client.createShare("test", null, 10)
+     * System.out.printf("Creating the share completed with status code %d", response.statusCode());
+     * 
+ * + * @param shareName Name of the share + * @param metadata Optional. Metadata to associate with the share + * @param quotaInGB Optional. Maximum size the share is allowed to grow to in GB. This must be greater than 0 and + * less than or equal to 5120. The default value is 5120. + * @return A response containing the ShareClient and the status of creating the share. + * @throws StorageErrorException If a share with the same name already exists or {@code quotaInGB} is outside the + * allowed range. + */ + public Response createShare(String shareName, Map metadata, Integer quotaInGB) { + Response response = client.createShare(shareName, metadata, quotaInGB).block(); + return FileServiceAsyncClient.mapToResponse(response, new ShareClient(response.value())); } - public Mono> createShare(String shareName, Map metadata, int quotaInGB) { - throw new UnsupportedOperationException(); + /** + * Deletes the share in the storage account with the given name + * + *

Code Samples

+ * + *

Delete the share "test"

+ * + * {@codesnippet com.azure.storage.file.fileServiceClient.deleteShare#string} + * + * @param shareName Name of the share + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the share doesn't exist + */ + public VoidResponse deleteShare(String shareName) { + return deleteShare(shareName, null); } - public Mono deleteShare(String shareName, String shareSnapshot) { - throw new UnsupportedOperationException(); + /** + * Deletes the specific snapshot of the share in the storage account with the given name. Snapshot are identified + * by the time they were created. + * + *

Code Samples

+ * + *

Delete the snapshot of share "test" that was created at midnight

+ * + *
+     * OffsetDateTime midnight = OffsetDateTime.of(LocalTime.MIDNIGHT, ZoneOffset.UTC));
+     * VoidResponse response = client.deleteShare("test", midnight.toString());
+     * System.out.printf("Deleting the snapshot completed with status code %d", response.statusCode());
+     * 
+ * + * @param shareName Name of the share + * @param shareSnapshot Identifier of the snapshot + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the share doesn't exist or the snapshot doesn't exist + */ + public VoidResponse deleteShare(String shareName, String shareSnapshot) { + return client.deleteShare(shareName, shareSnapshot).block(); } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/FileServiceClientBuilder.java b/storage/client/file/src/main/java/com/azure/storage/file/FileServiceClientBuilder.java index 01148e8af57f5..ee0eea1d60be8 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/FileServiceClientBuilder.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/FileServiceClientBuilder.java @@ -3,7 +3,304 @@ package com.azure.storage.file; -public class FileServiceClientBuilder { +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; +import com.azure.core.util.configuration.Configuration; +import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.common.policy.SASTokenCredentialPolicy; +import com.azure.storage.common.policy.SharedKeyCredentialPolicy; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; - // connection string, FileClientOptions, Uri, SharedKeyCredential +/** + * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link FileServiceClient FileServiceClients} + * and {@link FileServiceAsyncClient FileServiceAsyncClients}, calling {@link FileServiceClientBuilder#buildClient() buildClient} + * constructs an instance of FileServiceClient and calling {@link FileServiceClientBuilder#buildAsyncClient() buildAsyncClient} + * constructs an instance of FileServiceAsyncClient. + * + *

The client needs the endpoint of the Azure Storage File service and authorization credential. + * {@link FileServiceClientBuilder#endpoint(String) endpoint} gives the builder the endpoint and may give the builder a + * {@link SASTokenCredential} that authorizes the client.

+ * + *

Instantiating a synchronous FileService Client with SAS token

+ * {@codesnippet com.azure.storage.file.fileServiceClient.instantiation.sastoken} + * + *

Instantiating an Asynchronous FileService Client with SAS token

+ * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.instantiation.sastoken} + * + *

If the {@code endpoint} doesn't contain the query parameters to construct a {@code SASTokenCredential} they may + * be set using {@link FileServiceClientBuilder#credential(SASTokenCredential) credential}.

+ * + *
+ * FileServiceClient client = FileServiceClient.builder()
+ *     .endpoint(endpointWithoutSASTokenQueryParams)
+ *     .credential(SASTokenCredential.fromQuery(SASTokenQueryParams))
+ *     .buildClient();
+ * 
+ * + *
+ * FileServiceAsyncClient client = FileServiceAsyncClient.builder()
+ *     .endpoint(endpointWithoutSASTokenQueryParams)
+ *     .credential(SASTokenCredential.fromQuery(SASTokenQueryParams))
+ *     .buildAsyncClient();
+ * 
+ * + *

Another way to authenticate the client is using a {@link SharedKeyCredential}. To create a SharedKeyCredential + * a connection string from the Storage File service must be used. Set the SharedKeyCredential with + * {@link FileServiceClientBuilder#connectionString(String) connectionString}. If the builder has both a SASTokenCredential and + * SharedKeyCredential the SharedKeyCredential will be preferred when authorizing requests sent to the service.

+ * + *

Instantiating a synchronous FileService Client with connection string.

+ * {@codesnippet com.azure.storage.file.fileServiceClient.instantiation.connectionstring} + * + *

Instantiating an Asynchronous FileService Client with connection string.

+ * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.instantiation.connectionstring} + * + * @see FileServiceClient + * @see FileServiceAsyncClient + * @see SASTokenCredential + * @see SharedKeyCredential + */ +public final class FileServiceClientBuilder { + private static final String ACCOUNT_NAME = "AccountName".toLowerCase(); + private final List policies; + + private URL endpoint; + private SASTokenCredential sasTokenCredential; + private SharedKeyCredential sharedKeyCredential; + private HttpClient httpClient; + private HttpPipeline pipeline; + private HttpLogDetailLevel logLevel; + private RetryPolicy retryPolicy; + private Configuration configuration; + + /** + * Creates a builder instance that is able to configure and construct {@link FileServiceClient FileServiceClients} + * and {@link FileServiceAsyncClient FileServiceAsyncClients}. + */ + public FileServiceClientBuilder() { + retryPolicy = new RetryPolicy(); + logLevel = HttpLogDetailLevel.NONE; + policies = new ArrayList<>(); + configuration = ConfigurationManager.getConfiguration(); + } + + /** + * Creates a {@link FileServiceAsyncClient} based on options set in the builder. Every time {@code buildAsyncClient()} is + * called a new instance of {@link FileServiceAsyncClient} is created. + * + *

+ * If {@link FileServiceClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and + * {@link FileServiceClientBuilder#endpoint(String) endpoint} are used to create the + * {@link FileServiceAsyncClient client}. All other builder settings are ignored. + *

+ * + * @return A FileServiceAsyncClient with the options set from the builder. + * @throws NullPointerException If {@code endpoint} is {@code null}. + * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. + */ + public FileServiceAsyncClient buildAsyncClient() { + Objects.requireNonNull(endpoint); + + if (sasTokenCredential == null && sharedKeyCredential == null) { + throw new IllegalArgumentException("Credentials are required for authorization"); + } + + // Closest to API goes first, closest to wire goes last. + final List policies = new ArrayList<>(); + + policies.add(new UserAgentPolicy(FileConfiguration.NAME, FileConfiguration.VERSION, configuration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddDatePolicy()); + + if (sharedKeyCredential != null) { + policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); + } else { + policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); + } + + HttpPolicyProviders.addBeforeRetryPolicies(policies); + + policies.add(retryPolicy); + + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(logLevel)); + + HttpPipeline pipeline = HttpPipeline.builder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .build(); + + return new FileServiceAsyncClient(endpoint, pipeline); + } + + /** + * Creates a {@link FileServiceClient} based on options set in the builder. Every time {@code buildClient()} is + * called a new instance of {@link FileServiceClient} is created. + * + *

+ * If {@link FileServiceClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and + * {@link FileServiceClientBuilder#endpoint(String) endpoint} are used to create the + * {@link FileServiceClient client}. All other builder settings are ignored. + *

+ * + * @return A FileServiceClient with the options set from the builder. + * @throws NullPointerException If {@code endpoint} is {@code null}. + * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. + */ + public FileServiceClient buildClient() { + return new FileServiceClient(buildAsyncClient()); + } + + /** + * Sets the endpoint for the Azure Storage File instance that the client will interact with. + * + *

Query parameters of the endpoint will be parsed using {@link SASTokenCredential#fromQuery(String) fromQuery} in an + * attempt to generate a {@link SASTokenCredential} to authenticate requests sent to the service.

+ * + * @param endpoint The URL of the Azure Storage File instance to send service requests to and receive responses from. + * @return the updated FileServiceClientBuilder object + * @throws IllegalArgumentException If {@code endpoint} isn't a proper URL + */ + public FileServiceClientBuilder endpoint(String endpoint) { + Objects.requireNonNull(endpoint); + try { + URL fullURL = new URL(endpoint); + this.endpoint = new URL(fullURL.getProtocol() + "://" + fullURL.getHost()); + + // Attempt to get the SAS token from the URL passed + SASTokenCredential credential = SASTokenCredential.fromQuery(fullURL.getQuery()); + if (credential != null) { + this.sasTokenCredential = credential; + } + } catch (MalformedURLException ex) { + throw new IllegalArgumentException("The Azure Storage File Service endpoint url is malformed."); + } + + return this; + } + + /** + * Sets the {@link SASTokenCredential} used to authenticate requests sent to the Queue service. + * + * @param credential SAS token credential generated from the Storage account that authorizes requests + * @return the updated FileServiceClientBuilder object + * @throws NullPointerException If {@code credential} is {@code null}. + */ + public FileServiceClientBuilder credential(SASTokenCredential credential) { + this.sasTokenCredential = Objects.requireNonNull(credential); + return this; + } + + /** + * Creates a {@link SharedKeyCredential} from the {@code connectionString} used to authenticate requests sent to the + * File service. + * + * @param connectionString Connection string from the Access Keys section in the Storage account + * @return the updated FileServiceClientBuilder object + * @throws NullPointerException If {@code connectionString} is {@code null}. + */ + public FileServiceClientBuilder connectionString(String connectionString) { + Objects.requireNonNull(connectionString); + this.sharedKeyCredential = SharedKeyCredential.fromConnectionString(connectionString); + getEndPointFromConnectionString(connectionString); + return this; + } + + private void getEndPointFromConnectionString(String connectionString) { + Map connectionStringPieces = new HashMap<>(); + for (String connectionStringPiece : connectionString.split(";")) { + String[] kvp = connectionStringPiece.split("=", 2); + connectionStringPieces.put(kvp[0].toLowerCase(), kvp[1]); + } + String accountName = connectionStringPieces.get(ACCOUNT_NAME); + try { + this.endpoint = new URL(String.format("https://%s.file.core.windows.net", accountName)); + } catch (MalformedURLException e) { + throw new IllegalArgumentException(String.format("There is no valid endpoint for the connection string. " + + "Connection String: %s", connectionString)); + } + } + + /** + * Sets the HTTP client to use for sending and receiving requests to and from the service. + * + * @param httpClient The HTTP client to use for requests. + * @return The updated FileServiceClientBuilder object. + * @throws NullPointerException If {@code httpClient} is {@code null}. + */ + public FileServiceClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient); + return this; + } + + /** + * Adds a policy to the set of existing policies that are executed after the {@link RetryPolicy}. + * + * @param pipelinePolicy The retry policy for service requests. + * @return The updated FileServiceClientBuilder object. + * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. + */ + public FileServiceClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { + Objects.requireNonNull(pipelinePolicy); + this.policies.add(pipelinePolicy); + return this; + } + + /** + * Sets the logging level for HTTP requests and responses. + * + * @param logLevel The amount of logging output when sending and receiving HTTP requests/responses. + * @return The updated FileServiceClientBuilder object. + */ + public FileServiceClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { + this.logLevel = logLevel; + return this; + } + + /** + * Sets the HTTP pipeline to use for the service client. + * + * If {@code pipeline} is set, all other settings are ignored, aside from {@link FileServiceClientBuilder#endpoint(String) endpoint} + * when building clients. + * + * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. + * @return The updated FileServiceClientBuilder object. + * @throws NullPointerException If {@code pipeline} is {@code null}. + */ + public FileServiceClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = Objects.requireNonNull(pipeline); + return this; + } + + /** + * Sets the configuration store that is used during construction of the service client. + * + * The default configuration store is a clone of the {@link ConfigurationManager#getConfiguration() global + * configuration store}, use {@link Configuration#NONE} to bypass using configuration settings during construction. + * + * @param configuration The configuration store used to + * @return The updated FileServiceClientBuilder object. + * @throws NullPointerException If {@code configuration} is {@code null}. + */ + public FileServiceClientBuilder configuration(Configuration configuration) { + this.configuration = Objects.requireNonNull(configuration); + return this; + } } diff --git a/storage/client/src/main/java/com/azure/storage/file/README.md b/storage/client/file/src/main/java/com/azure/storage/file/README.md similarity index 100% rename from storage/client/src/main/java/com/azure/storage/file/README.md rename to storage/client/file/src/main/java/com/azure/storage/file/README.md diff --git a/storage/client/file/src/main/java/com/azure/storage/file/ShareAsyncClient.java b/storage/client/file/src/main/java/com/azure/storage/file/ShareAsyncClient.java index d6d1326ba9545..45730904cf54e 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/ShareAsyncClient.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/ShareAsyncClient.java @@ -3,81 +3,506 @@ package com.azure.storage.file; +import com.azure.core.http.HttpPipeline; import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.core.implementation.DateTimeRfc1123; +import com.azure.core.util.Context; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.file.implementation.AzureFileStorageBuilder; +import com.azure.storage.file.implementation.AzureFileStorageImpl; +import com.azure.storage.file.models.ShareCreateSnapshotHeaders; +import com.azure.storage.file.models.ShareGetPropertiesHeaders; import com.azure.storage.file.models.ShareInfo; import com.azure.storage.file.models.ShareProperties; import com.azure.storage.file.models.ShareSnapshotInfo; import com.azure.storage.file.models.ShareStatistics; +import com.azure.storage.file.models.SharesCreateSnapshotResponse; +import com.azure.storage.file.models.SharesGetPropertiesResponse; +import com.azure.storage.file.models.SharesGetStatisticsResponse; import com.azure.storage.file.models.SignedIdentifier; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - +import com.azure.storage.file.models.StorageErrorException; +import java.net.URL; +import java.time.OffsetDateTime; import java.util.List; import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +/** + * This class provides a client that contains all the operations for interacting with a share in Azure Storage Share. + * Operations allowed by the client are creating and deleting the share, creating snapshots for the share, creating and + * deleting directories in the share and retrieving and updating properties metadata and access policies of the share. + * + *

Instantiating an Asynchronous Share Client

+ * + *
+ * ShareAsyncClient client = ShareAsyncClient.builder()
+ *     .connectionString(connectionString)
+ *     .endpoint(endpoint)
+ *     .buildAsyncClient();
+ * 
+ * + *

View {@link ShareClientBuilder this} for additional ways to construct the client.

+ * + * @see ShareClientBuilder + * @see ShareClient + * @see SharedKeyCredential + * @see SASTokenCredential + */ public class ShareAsyncClient { + private final AzureFileStorageImpl client; + private final String shareName; + private final String shareSnapshot; + + /** + * Creates a ShareAsyncClient that sends requests to the storage share at {@link AzureFileStorageImpl#url() endpoint}. + * Each service call goes through the {@link HttpPipeline pipeline} in the {@code client}. + * + * @param client Client that interacts with the service interfaces + * @param shareName Name of the share + */ + ShareAsyncClient(AzureFileStorageImpl client, String shareName) { + this.shareName = shareName; + this.shareSnapshot = null; - ShareAsyncClient() { - throw new UnsupportedOperationException(); + this.client = new AzureFileStorageBuilder().pipeline(client.httpPipeline()) + .url(client.url()) + .version(client.version()) + .build(); } - public static ShareClientBuilder asyncBuilder() { - throw new UnsupportedOperationException(); + /** + * Creates a ShareAsyncClient that sends requests to the storage share at {@code endpoint}. + * Each service call goes through the {@code httpPipeline}. + * + * @param endpoint URL for the Storage File service + * @param httpPipeline HttpPipeline that the HTTP requests and response flow through + * @param shareName Name of the share + * @param shareSnapshot Optional. Specific snapshot of the share + */ + ShareAsyncClient(URL endpoint, HttpPipeline httpPipeline, String shareName, String shareSnapshot) { + this.shareName = shareName; + this.shareSnapshot = shareSnapshot; + + this.client = new AzureFileStorageBuilder().pipeline(httpPipeline) + .url(endpoint.toString()) + .build(); } - public String url() { - throw new UnsupportedOperationException(); + /** + * @return the getShareUrl of the storage file service + */ + public String getShareUrl() { + return client.url(); } + + /** + * Constructs a {@link DirectoryAsyncClient} that interacts with the root directory in the share. + * + *

If the directory doesn't exist in the share {@link DirectoryAsyncClient#create(Map) create} in the client will + * need to be called before interaction with the directory can happen.

+ * + * @return a {@link DirectoryAsyncClient} that interacts with the root directory in the share + */ public DirectoryAsyncClient getRootDirectoryClient() { - throw new UnsupportedOperationException(); + return getDirectoryClient(""); } + /** + * Constructs a {@link DirectoryAsyncClient} that interacts with the specified directory. + * + *

If the directory doesn't exist in the share {@link DirectoryAsyncClient#create(Map) create} in the client will + * need to be called before interaction with the directory can happen.

+ * + * @param directoryName Name of the directory + * @return a {@link DirectoryAsyncClient} that interacts with the directory in the share + */ public DirectoryAsyncClient getDirectoryClient(String directoryName) { - throw new UnsupportedOperationException(); + return new DirectoryAsyncClient(client, shareName, directoryName, shareSnapshot); } - public Mono> create(Map metadata, int quotaInGB) { - throw new UnsupportedOperationException(); + /** + * Creates the share in the storage account. + * + *

Code Samples

+ * + *

Create the share

+ * + * {@codesnippet com.azure.storage.file.shareAsyncClient.create} + * + * @return A response containing information about the share and the status its creation. + * @throws StorageErrorException If the share already exists with different metadata + */ + public Mono> create() { + return create(null, null); } + /** + * Creates the share in the storage account with the specified metadata and quota. + * + *

Code Samples

+ * + *

Create the share with metadata "share:metadata"

+ * + *
+     * client.createShare(Collections.singletonMap("share", "metadata"), null)
+     *     .subscribe(response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()));
+     * 
+ * + *

Create the share with a quota of 10 GB

+ * + *
+     * client.createShare(null, 10)
+     *     .subscribe(response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()));
+     * 
+ * + * @param metadata Optional. Metadata to associate with the share + * @param quotaInGB Optional. Maximum size the share is allowed to grow to in GB. This must be greater than 0 and + * less than or equal to 5120. The default value is 5120. + * @return A response containing information about the share and the status its creation. + * @throws StorageErrorException If the share already exists with different metadata or {@code quotaInGB} is outside the + * allowed range. + */ + public Mono> create(Map metadata, Integer quotaInGB) { + return client.shares().createWithRestResponseAsync(shareName, null, metadata, quotaInGB, Context.NONE) + .map(this::mapToShareInfoResponse); + } + + /** + * Creates a snapshot of the share with the same metadata associated to the share at the time of creation. + * + *

Code Samples

+ * + *

Create a snapshot

+ * + * {@codesnippet com.azure.storage.file.shareAsyncClient.createSnapshot} + * + * @return A response containing information about the snapshot of share. + * @throws StorageErrorException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is + * in progress for the share + */ + public Mono> createSnapshot() { + return createSnapshot(null); + } + + /** + * Creates a snapshot of the share with the metadata that was passed associated to the snapshot. + * + *

Code Samples

+ * + *

Create a snapshot with metadata "snapshot:metadata"

+ * + * {@codesnippet com.azure.storage.file.shareAsyncClient.createSnapshot#map} + * + * @param metadata Optional. Metadata to associate with the snapshot. If {@code null} the metadata of the share + * will be copied to the snapshot. + * @return A response containing information about the snapshot of share. + * @throws StorageErrorException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is + * in progress for the share + */ public Mono> createSnapshot(Map metadata) { - throw new UnsupportedOperationException(); + return client.shares().createSnapshotWithRestResponseAsync(shareName, null, metadata, Context.NONE) + .map(this::mapCreateSnapshotResponse); } + /** + * Deletes the share in the storage account + * + *

Code Samples

+ * + *

Delete the share

+ * + * {@codesnippet com.azure.storage.file.shareAsyncClient.delete} + * + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the share doesn't exist + */ + public Mono delete() { + return delete(null); + } + + /** + * Deletes the specific snapshot of the share in the storage account. Snapshot are identified by the time they + * were created. + * + *

Code Samples

+ * + *

Delete the snapshot of share that was created at midnight

+ * + *
+     * OffsetDateTime midnight = OffsetDateTime.of(LocalTime.MIDNIGHT, ZoneOffset.UTC));
+     * client.deleteShare(midnight.toString())
+     *     .subscribe(response -> System.out.printf("Deleting the snapshot completed with status code %d", response.statusCode()));
+     * 
+ * + * @param shareSnapshot Identifier of the snapshot + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the share doesn't exist or the snapshot doesn't exist + */ public Mono delete(String shareSnapshot) { - throw new UnsupportedOperationException(); + return client.shares().deleteWithRestResponseAsync(shareName, shareSnapshot, null, null, Context.NONE) + .map(VoidResponse::new); + } + + /** + * Retrieves the properties of the share, these include the metadata associated to it and the quota that the share + * is restricted to. + * + *

Code Samples

+ * + *

Retrieve the share properties

+ * + *
+     * client.getProperties()
+     *     .subscribe(response -> {
+     *         ShareProperties properties = response.value();
+     *         System.out.printf("Share quota: %d, Metadata: %s", properties.quota(), properties.metadata());
+     *     });
+     * 
+ * + * @return the properties of the share + * @throws StorageErrorException If the share doesn't exist + */ + public Mono> getProperties() { + return getProperties(null); } + /** + * Retrieves the properties of a specific snapshot of the share, these include the metadata associated to it and + * the quota that the share is restricted to. + * + *

Code Samples

+ * + *

Retrieve the properties from the snapshot at midnight

+ * + *
+     * OffsetDateTime midnight = OffsetDateTime.of(LocalTime.MIDNIGHT, ZoneOffset.UTC));
+     * client.getProperties(midnight.toString())
+     *     .subscribe(response -> {
+     *         ShareProperties properties = response.value();
+     *         System.out.printf("Share quota: %d, Metadata: %s", properties.quota(), properties.metadata());
+     *     });
+     * 
+ * + * @param shareSnapshot Identifier of the snapshot + * @return the properties of the share snapshot + * @throws StorageErrorException If the share or snapshot doesn't exist + */ public Mono> getProperties(String shareSnapshot) { - throw new UnsupportedOperationException(); + return client.shares().getPropertiesWithRestResponseAsync(shareName, shareSnapshot, null, Context.NONE) + .map(this::mapGetPropertiesResponse); } + /** + * Sets the maximum size in GB that the share is allowed to grow. + * + *

Code Samples

+ * + *

Set the quota to 1024 GB

+ * + *
+     * client.setQuota(1024)
+     *     .subscribe(response -> System.out.printf("Setting the share quota completed with status code %d", response.statusCode()));
+     * 
+ * + * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. + * @return information about the share + * @throws StorageErrorException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds + */ public Mono> setQuota(int quotaInGB) { - throw new UnsupportedOperationException(); + return client.shares().setQuotaWithRestResponseAsync(shareName, null, quotaInGB, Context.NONE) + .map(this::mapToShareInfoResponse); } + /** + * Sets the user-defined metadata to associate to the share. + * + *

If {@code null} is passed for the metadata it will clear the metadata associated to the share.

+ * + *

Code Samples

+ * + *

Set the metadata to "share:updatedMetadata"

+ * + *
+     * client.setMetadata(Collections.singletonMap("share", "updatedMetadata"))
+     *     .subscribe(response -> System.out.printf("Setting the share metadata completed with status code %d", response.statusCode()));
+     * 
+ * + *

Clear the metadata of the share

+ * + *
+     * client.setMetadata(null)
+     *     .subscribe(response -> System.out.printf("Clearing the share metadata completed with status code %d", response.statusCode()));
+     * 
+ * + * @param metadata Metadata to set on the share, if null is passed the metadata for the share is cleared + * @return information about the share + * @throws StorageErrorException If the share doesn't exist or the metadata contains invalid keys + */ public Mono> setMetadata(Map metadata) { - throw new UnsupportedOperationException(); + return client.shares().setMetadataWithRestResponseAsync(shareName, null, metadata, Context.NONE) + .map(this::mapToShareInfoResponse); } - public Flux listAccessPolicy() { - throw new UnsupportedOperationException(); + /** + * Retrieves stored access policies specified for the share. + * + *

Code Samples

+ * + *

List the stored access policies

+ * + *
+     * client.getAccessPolicy()
+     *     .subscribe(result -> System.out.printf("Access policy %s allows these permissions: %s", result.id(), result.accessPolicy().permission()));
+     * 
+ * + * @return The stored access policies specified on the queue. + * @throws StorageErrorException If the share doesn't exist + */ + public Flux getAccessPolicy() { + return client.shares().getAccessPolicyWithRestResponseAsync(shareName, Context.NONE) + .flatMapMany(response -> Flux.fromIterable(response.value())); } + + /** + * Sets stored access policies for the share. + * + *

Code Samples

+ * + *

Set a read only stored access policy

+ * + *
+     * AccessPolicy policy = new AccessPolicy().permission("r")
+     *     .start(OffsetDateTime.now(ZoneOffset.UTC))
+     *     .expiry(OffsetDateTime.now(ZoneOffset.UTC).addDays(10));
+     *
+     * SignedIdentifier permission = new SignedIdentifier().id("mypolicy").accessPolicy(accessPolicy);
+     *
+     * client.setAccessPolicy(Collections.singletonList(permission))
+     *     .subscribe(response -> System.out.printf("Setting access policies completed with status code %d", response.statusCode()));
+     * 
+ * + * @param permissions Access policies to set on the queue + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the share doesn't exist, a stored access policy doesn't have all fields filled out, + * or the share will have more than five policies. + */ public Mono> setAccessPolicy(List permissions) { - throw new UnsupportedOperationException(); + return client.shares().setAccessPolicyWithRestResponseAsync(shareName, permissions, null, Context.NONE) + .map(this::mapToShareInfoResponse); } + /** + * Retrieves storage statistics about the share. + * + *

Code Samples

+ * + *

Retrieve the storage statistics

+ * + *
+     * client.getStatistics()
+     *     .subscribe(response -> System.out.printf("The share is using %d GB", response.value().getShareUsageInGB()));
+     * 
+ * + * @return the storage statistics of the share + */ public Mono> getStatistics() { - throw new UnsupportedOperationException(); + return client.shares().getStatisticsWithRestResponseAsync(shareName, Context.NONE) + .map(this::mapGetStatisticsResponse); + } + + /** + * Creates the directory in the share with the given name. + * + *

Code Samples

+ * + *

Create the directory "mydirectory"

+ * + * {@codesnippet com.azure.storage.file.shareAsyncClient.createDirectory#string} + * * + * @param directoryName Name of the directory + * @return A response containing a {@link DirectoryAsyncClient} to interact with the created directory and the + * status of its creation. + * @throws StorageErrorException If the share doesn't exist, the directory already exists or is in the process of + * being deleted, or the parent directory for the new directory doesn't exist + */ + public Mono> createDirectory(String directoryName) { + return createDirectory(directoryName, null); } + /** + * Creates the directory in the share with the given name and associates the passed metadata to it. + * + *

Code Samples

+ * + *

Create the directory "documents" with metadata "directory:metadata"

+ * + *
+     * client.createDirectory("documents", Collections.singletonMap("directory", "metadata"))
+     *     .subscribe(response -> System.out.printf("Creating the directory completed with status code %d", response.statusCode()));
+     * 
+ * + * @param directoryName Name of the directory + * @param metadata Optional. Metadata to associate with the directory + * @return A response containing a {@link DirectoryAsyncClient} to interact with the created directory and the + * status of its creation. + * @throws StorageErrorException If the share doesn't exist, the directory already exists or is in the process of + * being deleted, the parent directory for the new directory doesn't exist, or the metadata is using an illegal + * key name + */ public Mono> createDirectory(String directoryName, Map metadata) { - throw new UnsupportedOperationException(); + DirectoryAsyncClient directoryAsyncClient = getDirectoryClient(directoryName); + return directoryAsyncClient.create(metadata).map(response -> new SimpleResponse<>(response, directoryAsyncClient)); } + /** + * Deletes the specified directory in the share. + * + *

Code Samples

+ * + *

Delete the directory "empty"

+ * + * {@codesnippet com.azure.storage.file.shareAsyncClient.deleteDirectory#string} + * + * @param directoryName Name of the directory + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the share doesn't exist or the directory isn't empty + */ public Mono deleteDirectory(String directoryName) { - throw new UnsupportedOperationException(); + return getDirectoryClient(directoryName).delete().map(VoidResponse::new); + } + + private Response mapToShareInfoResponse(Response response) { + String eTag = response.headers().value("ETag"); + OffsetDateTime lastModified = new DateTimeRfc1123(response.headers().value("Last-Modified")).dateTime(); + + return new SimpleResponse<>(response.request(), response.statusCode(), response.headers(), new ShareInfo(eTag, lastModified)); + } + + private Response mapCreateSnapshotResponse(SharesCreateSnapshotResponse response) { + ShareCreateSnapshotHeaders headers = response.deserializedHeaders(); + ShareSnapshotInfo snapshotInfo = new ShareSnapshotInfo(headers.snapshot(), headers.eTag(), headers.lastModified()); + + return new SimpleResponse<>(response.request(), response.statusCode(), response.headers(), snapshotInfo); + } + + private Response mapGetPropertiesResponse(SharesGetPropertiesResponse response) { + ShareGetPropertiesHeaders headers = response.deserializedHeaders(); + ShareProperties shareProperties = new ShareProperties().quota(headers.quota()) + .etag(headers.eTag()) + .lastModified(headers.lastModified()) + .metadata(headers.metadata()); + + return new SimpleResponse<>(response.request(), response.statusCode(), response.headers(), shareProperties); + } + + private Response mapGetStatisticsResponse(SharesGetStatisticsResponse response) { + ShareStatistics shareStatistics = new ShareStatistics(response.value().shareUsageBytes() / 1024); + + return new SimpleResponse<>(response.request(), response.statusCode(), response.headers(), shareStatistics); } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/ShareClient.java b/storage/client/file/src/main/java/com/azure/storage/file/ShareClient.java index 17ad31b4aa504..077b740318888 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/ShareClient.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/ShareClient.java @@ -1,82 +1,419 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + package com.azure.storage.file; import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; import com.azure.core.http.rest.VoidResponse; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; import com.azure.storage.file.models.ShareInfo; import com.azure.storage.file.models.ShareProperties; import com.azure.storage.file.models.ShareSnapshotInfo; import com.azure.storage.file.models.ShareStatistics; import com.azure.storage.file.models.SignedIdentifier; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - +import com.azure.storage.file.models.StorageErrorException; +import java.util.Arrays; import java.util.List; import java.util.Map; +/** + * This class provides a client that contains all the operations for interacting with a share in Azure Storage Share. + * Operations allowed by the client are creating and deleting the share, creating snapshots for the share, creating and + * deleting directories in the share and retrieving and updating properties metadata and access policies of the share. + * + *

Instantiating a Synchronous Share Client

+ * + *
+ * ShareClient client = ShareClient.builder()
+ *     .connectionString(connectionString)
+ *     .endpoint(endpoint)
+ *     .buildClient();
+ * 
+ * + *

View {@link ShareClientBuilder this} for additional ways to construct the client.

+ * + * @see ShareClientBuilder + * @see ShareAsyncClient + * @see SharedKeyCredential + * @see SASTokenCredential + */ public class ShareClient { - private final ShareAsyncClient client; - ShareClient() { - throw new UnsupportedOperationException(); - } - - public static ShareClientBuilder syncBuilder() { - throw new UnsupportedOperationException(); + ShareClient(ShareAsyncClient client) { + this.client = client; } - public String url() { - throw new UnsupportedOperationException(); + /** + * @return the getShareUrl of the storage file service + */ + public String getShareUrl() { + return client.getShareUrl(); } + /** + * Constructs a {@link DirectoryClient} that interacts with the root directory in the share. + * + *

If the directory doesn't exist in the share {@link DirectoryClient#create(Map) create} in the client will + * need to be called before interaction with the directory can happen.

+ * + * @return a {@link DirectoryClient} that interacts with the root directory in the share + */ public DirectoryClient getRootDirectoryClient() { - throw new UnsupportedOperationException(); + return getDirectoryClient(""); } + /** + * Constructs a {@link DirectoryClient} that interacts with the specified directory. + * + *

If the directory doesn't exist in the share {@link DirectoryClient#create(Map) create} in the client will + * need to be called before interaction with the directory can happen.

+ * + * @param directoryName Name of the directory + * @return a {@link DirectoryClient} that interacts with the directory in the share + */ public DirectoryClient getDirectoryClient(String directoryName) { - throw new UnsupportedOperationException(); + return new DirectoryClient(client.getDirectoryClient(directoryName)); } - public Mono> create(Map metadata, int quotaInGB) { - throw new UnsupportedOperationException(); + /** + * Creates the share in the storage account. + * + *

Code Samples

+ * + *

Create the share

+ * + * {@codesnippet com.azure.storage.file.shareClient.create} + * + * @return A response containing information about the share and the status its creation. + * @throws StorageErrorException If the share already exists with different metadata + */ + public Response create() { + return create(null, null); } - public Mono> createSnapshot(Map metadata) { - throw new UnsupportedOperationException(); + /** + * Creates the share in the storage account with the specified metadata and quota. + * + *

Code Samples

+ * + *

Create the share with metadata "share:metadata"

+ * + *
+     * Response<ShareInfo> response = client.createShare(Collections.singletonMap("share", "metadata"), null);
+     * System.out.printf("Creating the share completed with status code %d", response.statusCode());
+     * 
+ * + *

Create the share with a quota of 10 GB

+ * + *
+     * Response<ShareInfo> response = client.createShare(null, 10);
+     * System.out.printf("Creating the share completed with status code %d", response.statusCode());
+     * 
+ * + * @param metadata Optional. Metadata to associate with the share + * @param quotaInGB Optional. Maximum size the share is allowed to grow to in GB. This must be greater than 0 and + * less than or equal to 5120. The default value is 5120. + * @return A response containing information about the share and the status its creation. + * @throws StorageErrorException If the share already exists with different metadata or {@code quotaInGB} is outside the + * allowed range. + */ + public Response create(Map metadata, Integer quotaInGB) { + return client.create(metadata, quotaInGB).block(); } - public Mono delete(String shareSnapshot) { - throw new UnsupportedOperationException(); + /** + * Creates a snapshot of the share with the same metadata associated to the share at the time of creation. + * + *

Code Samples

+ * + *

Create a snapshot

+ * + * {@codesnippet com.azure.storage.file.shareClient.createSnapshot} + * + * @return A response containing information about the snapshot of share. + * @throws StorageErrorException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is + * in progress for the share + */ + public Response createSnapshot() { + return createSnapshot(null); } - public Mono> getProperties(String shareSnapshot) { - throw new UnsupportedOperationException(); + /** + * Creates a snapshot of the share with the metadata that was passed associated to the snapshot. + * + *

Code Samples

+ * + *

Create a snapshot with metadata "snapshot:metadata"

+ * + * {@codesnippet com.azure.storage.file.shareClient.createSnapshot#map} + * + * @param metadata Optional. Metadata to associate with the snapshot. If {@code null} the metadata of the share + * will be copied to the snapshot. + * @return A response containing information about the snapshot of share. + * @throws StorageErrorException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is + * in progress for the share + */ + public Response createSnapshot(Map metadata) { + return client.createSnapshot(metadata).block(); } - public Mono> setQuota(int quotaInGB) { - throw new UnsupportedOperationException(); + /** + * Deletes the share in the storage account + * + *

Code Samples

+ * + *

Delete the share

+ * + * {@codesnippet com.azure.storage.file.shareClient.delete} + * + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the share doesn't exist + */ + public VoidResponse delete() { + return delete(null); } - public Mono> setMetadata(Map metadata) { - throw new UnsupportedOperationException(); + /** + * Deletes the specific snapshot of the share in the storage account. Snapshot are identified by the time they + * were created. + * + *

Code Samples

+ * + *

Delete the snapshot of share that was created at midnight

+ * + *
+     * OffsetDateTime midnight = OffsetDateTime.of(LocalTime.MIDNIGHT, ZoneOffset.UTC));
+     * VoidResponse response = client.deleteShare(midnight.toString());
+     * System.out.printf("Deleting the snapshot completed with status code %d", response.statusCode());
+     * 
+ * + * @param shareSnapshot Identifier of the snapshot + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the share doesn't exist or the snapshot doesn't exist + */ + public VoidResponse delete(String shareSnapshot) { + return client.delete(shareSnapshot).block(); } - public Flux listAccessPolicy() { - throw new UnsupportedOperationException(); + /** + * Retrieves the properties of the share, these include the metadata associated to it and the quota that the share + * is restricted to. + * + *

Code Samples

+ * + *

Retrieve the share properties

+ * + *
+     * ShareProperties properties = client.getProperties().value();
+     * System.out.printf("Share quota: %d, Metadata: %s", properties.quota(), properties.metadata());
+     * 
+ * + * @return the properties of the share + * @throws StorageErrorException If the share doesn't exist + */ + public Response getProperties() { + return getProperties(null); } - public Mono> setAccessPolicy(List permissions) { - throw new UnsupportedOperationException(); + + /** + * Retrieves the properties of a specific snapshot of the share, these include the metadata associated to it and + * the quota that the share is restricted to. + * + *

Code Samples

+ * + *

Retrieve the properties from the snapshot at midnight

+ * + *
+     * OffsetDateTime midnight = OffsetDateTime.of(LocalTime.MIDNIGHT, ZoneOffset.UTC));
+     * ShareProperties properties = client.getProperties(midnight.toString()).value();
+     * System.out.printf("Share quota: %d, Metadata: %s", properties.quota(), properties.metadata());
+     * 
+ * + * @param shareSnapshot Identifier of the snapshot + * @return the properties of the share snapshot + * @throws StorageErrorException If the share or snapshot doesn't exist + */ + public Response getProperties(String shareSnapshot) { + return client.getProperties(shareSnapshot).block(); + } + + /** + * Sets the maximum size in GB that the share is allowed to grow. + * + *

Code Samples

+ * + *

Set the quota to 1024 GB

+ * + *
+     * Response<ShareInfo> response = client.setQuota(1024);
+     * System.out.printf("Setting the share quota completed with status code %d", response.statusCode());
+     * 
+ * + * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. + * @return information about the share + * @throws StorageErrorException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds + */ + public Response setQuota(int quotaInGB) { + return client.setQuota(quotaInGB).block(); } - public Mono> getStatistics() { - throw new UnsupportedOperationException(); + /** + * Sets the user-defined metadata to associate to the share. + * + *

If {@code null} is passed for the metadata it will clear the metadata associated to the share.

+ * + *

Code Samples

+ * + *

Set the metadata to "share:updatedMetadata"

+ * + *
+     * Response<ShareInfo> response = client.setMetadata(Collections.singletonMap("share", "updatedMetadata"));
+     * System.out.printf("Setting the share metadata completed with status code %d", response.statusCode());
+     * 
+ * + *

Clear the metadata of the share

+ * + *
+     * Response<ShareInfo> response = client.setMetadata(null);
+     * System.out.printf("Clearing the share metadata completed with status code %d", response.statusCode());
+     * 
+ * + * @param metadata Metadata to set on the share, if null is passed the metadata for the share is cleared + * @return information about the share + * @throws StorageErrorException If the share doesn't exist or the metadata contains invalid keys + */ + public Response setMetadata(Map metadata) { + return client.setMetadata(metadata).block(); } - public Mono> createDirectory(String directoryName, Map metadata) { - throw new UnsupportedOperationException(); + /** + * Retrieves stored access policies specified for the share. + * + *

Code Samples

+ * + *

List the stored access policies

+ * + *
+     * for (SignedIdentifier result : client.getAccessPolicy()) {
+     *     System.out.printf("Access policy %s allows these permissions: %s", result.id(), result.accessPolicy().permission());
+     * }
+     * 
+ * + * @return The stored access policies specified on the queue. + * @throws StorageErrorException If the share doesn't exist + */ + public Iterable getAccessPolicy() { + return client.getAccessPolicy().toIterable(); } - public Mono deleteDirectory(String directoryName) { - throw new UnsupportedOperationException(); + /** + * Sets stored access policies for the share. + * + *

Code Samples

+ * + *

Set a read only stored access policy

+ * + *
+     * AccessPolicy policy = new AccessPolicy().permission("r")
+     *     .start(OffsetDateTime.now(ZoneOffset.UTC))
+     *     .expiry(OffsetDateTime.now(ZoneOffset.UTC).addDays(10));
+     *
+     * SignedIdentifier permission = new SignedIdentifier().id("mypolicy").accessPolicy(accessPolicy);
+     *
+     * Response<ShareInfo> response = client.setAccessPolicy(Collections.singletonList(permission));
+     * System.out.printf("Setting access policies completed with status code %d", response.statusCode());
+     * 
+ * + * @param permissions Access policies to set on the queue + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the share doesn't exist, a stored access policy doesn't have all fields filled out, + * or the share will have more than five policies. + */ + public Response setAccessPolicy(List permissions) { + List p = Arrays.asList(new SignedIdentifier()); + return client.setAccessPolicy(permissions).block(); } + + /** + * Retrieves storage statistics about the share. + * + *

Code Samples

+ * + *

Retrieve the storage statistics

+ * + *
+     * Response<ShareStatistics> response = client.getStatistics();
+     * System.out.printf("The share is using %d GB", response.value().getShareUsageInGB());
+     * 
+ * + * @return the storage statistics of the share + */ + public Response getStatistics() { + return client.getStatistics().block(); + } + + /** + * Creates the directory in the share with the given name. + * + *

Code Samples

+ * + *

Create the directory "documents"

+ * + * {@codesnippet com.azure.storage.file.shareClient.createDirectory#string} + * + * @param directoryName Name of the directory + * @return A response containing a {@link DirectoryClient} to interact with the created directory and the + * status of its creation. + * @throws StorageErrorException If the share doesn't exist, the directory already exists or is in the process of + * being deleted, or the parent directory for the new directory doesn't exist + */ + public Response createDirectory(String directoryName) { + return createDirectory(directoryName, null); + } + + /** + * Creates the directory in the share with the given name and associates the passed metadata to it. + * + *

Code Samples

+ * + *

Create the directory "documents" with metadata "directory:metadata"

+ * + *
+     * Response<DirectoryClient> response = client.createDirectory("documents", Collections.singletonMap("directory", "metadata"));
+     * System.out.printf("Creating the directory completed with status code %d", response.statusCode());
+     * 
+ * + * @param directoryName Name of the directory + * @param metadata Optional. Metadata to associate with the directory + * @return A response containing a {@link DirectoryAsyncClient} to interact with the created directory and the + * status of its creation. + * @throws StorageErrorException If the share doesn't exist, the directory already exists or is in the process of + * being deleted, the parent directory for the new directory doesn't exist, or the metadata is using an illegal + * key name + */ + public Response createDirectory(String directoryName, Map metadata) { + DirectoryClient directoryClient = getDirectoryClient(directoryName); + return new SimpleResponse<>(directoryClient.create(metadata), directoryClient); + } + + /** + * Deletes the specified directory in the share. + * + *

Code Samples

+ * + *

Delete the directory "empty"

+ * + * {@codesnippet com.azure.storage.file.shareClient.deleteDirectory#string} + * + * @param directoryName Name of the directory + * @return A response that only contains headers and response status code + * @throws StorageErrorException If the share doesn't exist or the directory isn't empty + */ + public VoidResponse deleteDirectory(String directoryName) { + return client.deleteDirectory(directoryName).block(); + } + } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/ShareClientBuilder.java b/storage/client/file/src/main/java/com/azure/storage/file/ShareClientBuilder.java index 5ab4e37ddcd3e..99a652fb5c4d9 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/ShareClientBuilder.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/ShareClientBuilder.java @@ -3,7 +3,342 @@ package com.azure.storage.file; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; +import com.azure.core.util.configuration.Configuration; +import com.azure.core.util.configuration.ConfigurationManager; +import com.azure.storage.common.credentials.SASTokenCredential; +import com.azure.storage.common.credentials.SharedKeyCredential; +import com.azure.storage.common.policy.SASTokenCredentialPolicy; +import com.azure.storage.common.policy.SharedKeyCredentialPolicy; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link ShareClient ShareClients} + * and {@link ShareAsyncClient SahreAsyncClients}, calling {@link ShareClientBuilder#buildClient() buildClient} + * constructs an instance of ShareClient and calling {@link ShareClientBuilder#buildAsyncClient() buildAsyncClient} + * constructs an instance of SahreAsyncClient. + * + *

The client needs the endpoint of the Azure Storage File service, name of the share, and authorization credential. + * {@link ShareClientBuilder#endpoint(String) endpoint} gives the builder the endpoint and may give the builder the + * {@link ShareClientBuilder#shareName(String) shareName} and a {@link SASTokenCredential} that authorizes the client.

+ * + *

Instantiating a synchronous Share Client with SAS token

+ * {@codesnippet com.azure.storage.file.shareClient.instantiation.sastoken} + * + *

Instantiating an Asynchronous Share Client with SAS token

+ * {@codesnippet com.azure.storage.file.shareAsyncClient.instantiation.sastoken} + * + *

If the {@code endpoint} doesn't contain the query parameters to construct a {@code SASTokenCredential} they may + * be set using {@link ShareClientBuilder#credential(SASTokenCredential) credential}.

+ * + *
+ * ShareClient client = ShareClient.builder()
+ *     .endpoint(endpointWithoutSASTokenQueryParams)
+ *     .shareName(shareName)
+ *     .credential(SASTokenCredential.fromQuery(SASTokenQueryParams))
+ *     .buildClient();
+ * 
+ * + *
+ * ShareAsyncClient client = ShareAsyncClient.builder()
+ *     .endpoint(endpointWithoutSASTokenQueryParams)
+ *     .shareName(shareName)
+ *     .credential(SASTokenCredential.fromQuery(SASTokenQueryParams))
+ *     .buildAsyncClient();
+ * 
+ * + *

Another way to authenticate the client is using a {@link SharedKeyCredential}. To create a SharedKeyCredential + * a connection string from the Storage File service must be used. Set the SharedKeyCredential with + * {@link ShareClientBuilder#connectionString(String) connectionString}. If the builder has both a SASTokenCredential and + * SharedKeyCredential the SharedKeyCredential will be preferred when authorizing requests sent to the service.

+ * + *

Instantiating a synchronous Share Client with connection string.

+ * {@codesnippet com.azure.storage.file.shareClient.instantiation.connectionstring} + * + *

Instantiating an Asynchronous Share Client with connection string.

+ * {@codesnippet com.azure.storage.file.shareAsyncClient.instantiation.connectionstring} + * + * @see ShareClient + * @see ShareAsyncClient + * @see SASTokenCredential + * @see SharedKeyCredential + */ public class ShareClientBuilder { + private static final String ACCOUNT_NAME = "AccountName".toLowerCase(); + private final List policies; + + private URL endpoint; + private SASTokenCredential sasTokenCredential; + private SharedKeyCredential sharedKeyCredential; + private String shareName; + private String shareSnapshot; + private HttpClient httpClient; + private HttpPipeline pipeline; + private HttpLogDetailLevel logLevel; + private RetryPolicy retryPolicy; + private Configuration configuration; + + /** + * Creates a builder instance that is able to configure and construct {@link ShareClient ShareClients} + * and {@link ShareAsyncClient ShareAsyncClients}. + */ + public ShareClientBuilder() { + retryPolicy = new RetryPolicy(); + logLevel = HttpLogDetailLevel.NONE; + policies = new ArrayList<>(); + configuration = ConfigurationManager.getConfiguration(); + } + + /** + * Creates a {@link ShareAsyncClient} based on options set in the builder. Every time {@code buildAsyncClient()} is + * called a new instance of {@link ShareAsyncClient} is created. + * + *

+ * If {@link ShareClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and + * {@link ShareClientBuilder#endpoint(String) endpoint} are used to create the + * {@link ShareAsyncClient client}. All other builder settings are ignored. + *

+ * + * @return A ShareAsyncClient with the options set from the builder. + * @throws NullPointerException If {@code endpoint} or {@code shareName} is {@code null}. + * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. + */ + public ShareAsyncClient buildAsyncClient() { + Objects.requireNonNull(endpoint); + Objects.requireNonNull(shareName); + + if (pipeline != null) { + return new ShareAsyncClient(endpoint, pipeline, shareName, shareSnapshot); + } + + if (sasTokenCredential == null && sharedKeyCredential == null) { + throw new IllegalArgumentException("Credentials are required for authorization"); + } + + // Closest to API goes first, closest to wire goes last. + final List policies = new ArrayList<>(); + + policies.add(new UserAgentPolicy(FileConfiguration.NAME, FileConfiguration.VERSION, configuration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddDatePolicy()); + + if (sharedKeyCredential != null) { + policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); + } else { + policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); + } + + HttpPolicyProviders.addBeforeRetryPolicies(policies); + + policies.add(retryPolicy); + + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(logLevel)); + + HttpPipeline pipeline = HttpPipeline.builder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .build(); + + return new ShareAsyncClient(endpoint, pipeline, shareName, shareSnapshot); + } + + /** + * Creates a {@link ShareClient} based on options set in the builder. Every time {@code buildClient()} is + * called a new instance of {@link ShareClient} is created. + * + *

+ * If {@link ShareClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and + * {@link ShareClientBuilder#endpoint(String) endpoint} are used to create the + * {@link ShareClient client}. All other builder settings are ignored. + *

+ * + * @return A ShareClient with the options set from the builder. + * @throws NullPointerException If {@code endpoint} or {@code shareName} is {@code null}. + * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. + */ + public ShareClient buildClient() { + return new ShareClient(buildAsyncClient()); + } + + /** + * Sets the endpoint for the Azure Storage File instance that the client will interact with. + * + *

The first path segment, if the endpoint contains path segments, will be assumed to be the name of the share + * that the client will interact with.

+ * + *

Query parameters of the endpoint will be parsed using {@link SASTokenCredential#fromQuery(String)} in an + * attempt to generate a {@link SASTokenCredential} to authenticate requests sent to the service.

+ * + * @param endpoint The URL of the Azure Storage File instance to send service requests to and receive responses from. + * @return the updated ShareClientBuilder object + * @throws IllegalArgumentException If {@code endpoint} is {@code null} or is an invalid URL + */ + public ShareClientBuilder endpoint(String endpoint) { + Objects.requireNonNull(endpoint); + try { + URL fullURL = new URL(endpoint); + this.endpoint = new URL(fullURL.getProtocol() + "://" + fullURL.getHost()); + + // Attempt to get the SAS token from the URL passed + SASTokenCredential credential = SASTokenCredential.fromQuery(fullURL.getQuery()); + if (credential != null) { + this.sasTokenCredential = credential; + } + } catch (MalformedURLException ex) { + throw new IllegalArgumentException("The Azure Storage File Service endpoint url is malformed."); + } + + return this; + } + + /** + * Sets the {@link SASTokenCredential} used to authenticate requests sent to the File service. + * + * @param credential SAS token credential generated from the Storage account that authorizes requests + * @return the updated ShareClientBuilder object + * @throws NullPointerException If {@code credential} is {@code null}. + */ + public ShareClientBuilder credential(SASTokenCredential credential) { + this.sasTokenCredential = Objects.requireNonNull(credential); + return this; + } + + /** + * Creates a {@link SharedKeyCredential} from the {@code connectionString} used to authenticate requests sent to the + * File service. + * + * @param connectionString Connection string from the Access Keys section in the Storage account + * @return the updated ShareClientBuilder object + * @throws NullPointerException If {@code connectionString} is {@code null}. + */ + public ShareClientBuilder connectionString(String connectionString) { + Objects.requireNonNull(connectionString); + this.sharedKeyCredential = SharedKeyCredential.fromConnectionString(connectionString); + getEndPointFromConnectionString(connectionString); + return this; + } + + private void getEndPointFromConnectionString(String connectionString) { + Map connectionStringPieces = new HashMap<>(); + for (String connectionStringPiece : connectionString.split(";")) { + String[] kvp = connectionStringPiece.split("=", 2); + connectionStringPieces.put(kvp[0].toLowerCase(), kvp[1]); + } + String accountName = connectionStringPieces.get(ACCOUNT_NAME); + try { + this.endpoint = new URL(String.format("https://%s.file.core.windows.net", accountName)); + } catch (MalformedURLException e) { + throw new IllegalArgumentException(String.format("There is no valid endpoint for the connection string. " + + "Connection String: %s", connectionString)); + } + } + + /** + * Sets the share that the constructed clients will interact with + * + * @param shareName Name of the share + * @return the updated ShareClientBuilder object + * @throws NullPointerException If {@code shareName} is {@code null}. + */ + public ShareClientBuilder shareName(String shareName) { + this.shareName = Objects.requireNonNull(shareName); + return this; + } + + /** + * Sets the snapshot that the constructed clients will interact with. This snapshot must be linked to the share + * that has been specified in the builder. + * + * @param shareSnapshot Identifier of the snapshot + * @return the updated ShareClientBuilder object + * @throws NullPointerException If {@code shareSnapshot} is {@code null}. + */ + public ShareClientBuilder shareSnapshot(String shareSnapshot) { + this.shareSnapshot = Objects.requireNonNull(shareSnapshot); + return this; + } + + /** + * Sets the HTTP client to use for sending and receiving requests to and from the service. + * + * @param httpClient The HTTP client to use for requests. + * @return The updated ShareClientBuilder object. + * @throws NullPointerException If {@code httpClient} is {@code null}. + */ + public ShareClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient); + return this; + } + + /** + * Adds a policy to the set of existing policies that are executed after the {@link RetryPolicy}. + * + * @param pipelinePolicy The retry policy for service requests. + * @return The updated ShareClientBuilder object. + * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. + */ + public ShareClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { + Objects.requireNonNull(pipelinePolicy); + this.policies.add(pipelinePolicy); + return this; + } + + /** + * Sets the logging level for HTTP requests and responses. + * + * @param logLevel The amount of logging output when sending and receiving HTTP requests/responses. + * @return The updated ShareClientBuilder object. + */ + public ShareClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { + this.logLevel = logLevel; + return this; + } + + /** + * Sets the HTTP pipeline to use for the service client. + * + *

If {@code pipeline} is set, all other settings are ignored, aside from {@link ShareClientBuilder#endpoint(String) endpoint}, + * {@link ShareClientBuilder#shareName(String) shareName}, and {@link ShareClientBuilder#shareSnapshot(String) snaphotShot} + * when building clients.

+ * + * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. + * @return The updated ShareClientBuilder object. + * @throws NullPointerException If {@code pipeline} is {@code null}. + */ + public ShareClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = Objects.requireNonNull(pipeline); + return this; + } - // connectionString, shareName, FileClientOptions, withSnapshot, SharedKeyCredential, + /** + * Sets the configuration store that is used during construction of the service client. + * + * The default configuration store is a clone of the {@link ConfigurationManager#getConfiguration() global + * configuration store}, use {@link Configuration#NONE} to bypass using configuration settings during construction. + * + * @param configuration The configuration store used to + * @return The updated ShareClientBuilder object. + * @throws NullPointerException If {@code configuration} is {@code null}. + */ + public ShareClientBuilder configuration(Configuration configuration) { + this.configuration = Objects.requireNonNull(configuration); + return this; + } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/implementation/DirectorysImpl.java b/storage/client/file/src/main/java/com/azure/storage/file/implementation/DirectorysImpl.java index 4e3f44c781ef9..b2afc6d343585 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/implementation/DirectorysImpl.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/implementation/DirectorysImpl.java @@ -11,6 +11,7 @@ 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; @@ -23,9 +24,9 @@ import com.azure.storage.file.models.DirectorysListFilesAndDirectoriesSegmentResponse; import com.azure.storage.file.models.DirectorysListHandlesResponse; import com.azure.storage.file.models.DirectorysSetMetadataResponse; +import com.azure.storage.file.models.FilesDeleteResponse; import com.azure.storage.file.models.StorageErrorException; import reactor.core.publisher.Mono; - import java.util.Map; /** @@ -49,7 +50,7 @@ public final class DirectorysImpl { * @param client the instance of the service client containing this operation class. */ public DirectorysImpl(AzureFileStorageImpl client) { - this.service = RestProxy.create(DirectorysService.class, client); + this.service = RestProxy.create(DirectorysService.class, client.httpPipeline()); this.client = client; } @@ -58,164 +59,235 @@ public DirectorysImpl(AzureFileStorageImpl client) { * proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Files Directory") + @Service("Storage File Directories") private interface DirectorysService { @PUT("{shareName}/{directory}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono create(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); + Mono create(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("directory") String directoryName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); @GET("{shareName}/{directory}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getProperties(@HostParam("url") String url, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); + Mono getProperties(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("directory") String directoryName, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); @DELETE("{shareName}/{directory}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono delete(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); + Mono delete(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("directory") String directoryName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); + + @DELETE("{shareName}/{directory}/{fileName}") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(StorageErrorException.class) + Mono delete(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("directory") String directoryName, @PathParam("fileName") String fileName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); @PUT("{shareName}/{directory}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setMetadata(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + Mono setMetadata(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("directory") String directoryName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @GET("{shareName}/{directory}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono listFilesAndDirectoriesSegment(@HostParam("url") String url, @QueryParam("prefix") String prefix, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + Mono listFilesAndDirectoriesSegment(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("directory") String directoryName, @QueryParam("prefix") String prefix, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @GET("{shareName}/{directory}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono listHandles(@HostParam("url") String url, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("timeout") Integer timeout, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-recursive") Boolean recursive, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); + Mono listHandles(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("directory") String directoryName, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("timeout") Integer timeout, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-recursive") Boolean recursive, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); @PUT("{shareName}/{directory}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono forceCloseHandles(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @QueryParam("marker") String marker, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-handle-id") String handleId, @HeaderParam("x-ms-recursive") Boolean recursive, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); + Mono forceCloseHandles(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("directory") String directoryName, @QueryParam("timeout") Integer timeout, @QueryParam("marker") String marker, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-handle-id") String handleId, @HeaderParam("x-ms-recursive") Boolean recursive, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); } /** * Creates a new directory under the specified share or parent directory. * + * @param shareName Name of the share. + * @param directoryName Path to the directory. * @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. */ - public Mono createWithRestResponseAsync(Context context) { + public Mono createWithRestResponseAsync(String shareName, String directoryName, Context context) { final Integer timeout = null; final Map metadata = null; final String restype = "directory"; - return service.create(this.client.url(), timeout, metadata, this.client.version(), restype, context); + return service.create(this.client.url(), shareName, directoryName, timeout, metadata, this.client.version(), restype, context); } /** * Creates a new directory under the specified share or parent directory. * + * @param shareName Name of the share. + * @param directoryName Path to the directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param metadata A name-value pair to associate with a file storage object. * @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. */ - public Mono createWithRestResponseAsync(Integer timeout, Map metadata, Context context) { + public Mono createWithRestResponseAsync(String shareName, String directoryName, Integer timeout, Map metadata, Context context) { final String restype = "directory"; - return service.create(this.client.url(), timeout, metadata, this.client.version(), restype, context); + return service.create(this.client.url(), shareName, directoryName, timeout, metadata, this.client.version(), restype, context); + } + + /** + * Creates a new directory under the specified share or parent directory. + * + * @param shareName Name of the share. + * @param directoryName Path to the directory. + * @param metadata A name-value pair to associate with a file storage object. + * @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. + */ + public Mono createSubDirectoryWithRestResponseAsync(String shareName, String directoryName, Map metadata, Context context) { + final Integer timeout = null; + final String restype = "directory"; + return service.create(this.client.url(), shareName, directoryName, timeout, metadata, this.client.version(), restype, context); } /** * Returns all system properties for the specified directory, and can also be used to check the existence of a directory. The data returned does not include the files in the directory or any subdirectories. * + * @param shareName Name of the share. + * @param directoryName Path to the directory. * @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. */ - public Mono getPropertiesWithRestResponseAsync(Context context) { + public Mono getPropertiesWithRestResponseAsync(String shareName, String directoryName, Context context) { final String sharesnapshot = null; final Integer timeout = null; final String restype = "directory"; - return service.getProperties(this.client.url(), sharesnapshot, timeout, this.client.version(), restype, context); + return service.getProperties(this.client.url(), shareName, directoryName, sharesnapshot, timeout, this.client.version(), restype, context); } /** * Returns all system properties for the specified directory, and can also be used to check the existence of a directory. The data returned does not include the files in the directory or any subdirectories. * + * @param shareName Name of the share. + * @param directoryName Path to the directory. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @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. */ - public Mono getPropertiesWithRestResponseAsync(String sharesnapshot, Integer timeout, Context context) { + public Mono getPropertiesWithRestResponseAsync(String shareName, String directoryName, String sharesnapshot, Integer timeout, Context context) { final String restype = "directory"; - return service.getProperties(this.client.url(), sharesnapshot, timeout, this.client.version(), restype, context); + return service.getProperties(this.client.url(), shareName, directoryName, sharesnapshot, timeout, this.client.version(), restype, context); } /** * Removes the specified empty directory. Note that the directory must be empty before it can be deleted. * + * @param shareName Name of the share. + * @param directoryName Path to the directory. * @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. */ - public Mono deleteWithRestResponseAsync(Context context) { + public Mono deleteWithRestResponseAsync(String shareName, String directoryName, Context context) { final Integer timeout = null; final String restype = "directory"; - return service.delete(this.client.url(), timeout, this.client.version(), restype, context); + return service.delete(this.client.url(), shareName, directoryName, timeout, this.client.version(), restype, context); + } + + /** + * Removes the specified empty directory. Note that the directory must be empty before it can be deleted. + * + * @param shareName Name of the share. + * @param directoryName Path to the directory. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. + * @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. + */ + public Mono deleteWithRestResponseAsync(String shareName, String directoryName, Integer timeout, Context context) { + final String restype = "directory"; + return service.delete(this.client.url(), shareName, directoryName, timeout, this.client.version(), restype, context); } + /** * Removes the specified empty directory. Note that the directory must be empty before it can be deleted. * + * @param shareName Name of the share. + * @param directoryName Path to the directory. + * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. + * @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. + */ + public Mono deleteSubWithRestResponseAsync(String shareName, String directoryName, Integer timeout, Context context) { + final String restype = "directory"; + return service.delete(this.client.url(), shareName, directoryName, timeout, this.client.version(), restype, context); + } + + /** + * Removes the specified file. + * + * @param shareName Name of the share. + * @param directoryName Path to the directory. + * @param fileName Name of the file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @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. */ - public Mono deleteWithRestResponseAsync(Integer timeout, Context context) { + public Mono deleteFileWithRestResponseAsync(String shareName, String directoryName, String fileName, Integer timeout, Context context) { final String restype = "directory"; - return service.delete(this.client.url(), timeout, this.client.version(), restype, context); + return service.delete(this.client.url(), shareName, directoryName, fileName, timeout, this.client.version(), restype, context); } /** * Updates user defined metadata for the specified directory. * + * @param shareName Name of the share. + * @param directoryName Path to the directory. * @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. */ - public Mono setMetadataWithRestResponseAsync(Context context) { + public Mono setMetadataWithRestResponseAsync(String shareName, String directoryName, Context context) { final Integer timeout = null; final Map metadata = null; final String restype = "directory"; final String comp = "metadata"; - return service.setMetadata(this.client.url(), timeout, metadata, this.client.version(), restype, comp, context); + return service.setMetadata(this.client.url(), shareName, directoryName, timeout, metadata, this.client.version(), restype, comp, context); } /** * Updates user defined metadata for the specified directory. * + * @param shareName Name of the share. + * @param directoryName Path to the directory. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param metadata A name-value pair to associate with a file storage object. * @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. */ - public Mono setMetadataWithRestResponseAsync(Integer timeout, Map metadata, Context context) { + public Mono setMetadataWithRestResponseAsync(String shareName, String directoryName, Integer timeout, Map metadata, Context context) { final String restype = "directory"; final String comp = "metadata"; - return service.setMetadata(this.client.url(), timeout, metadata, this.client.version(), restype, comp, context); + return service.setMetadata(this.client.url(), shareName, directoryName, timeout, metadata, this.client.version(), restype, comp, context); } /** * Returns a list of files or directories under the specified share or directory. It lists the contents only for a single level of the directory hierarchy. * + * @param shareName Name of the share. + * @param directoryName Path to the directory. * @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. */ - public Mono listFilesAndDirectoriesSegmentWithRestResponseAsync(Context context) { + public Mono listFilesAndDirectoriesSegmentWithRestResponseAsync(String shareName, String directoryName, Context context) { final String prefix = null; final String sharesnapshot = null; final String marker = null; @@ -223,12 +295,14 @@ public Mono listFilesAndDirect final Integer timeout = null; final String restype = "directory"; final String comp = "list"; - return service.listFilesAndDirectoriesSegment(this.client.url(), prefix, sharesnapshot, marker, maxresults, timeout, this.client.version(), restype, comp, context); + return service.listFilesAndDirectoriesSegment(this.client.url(), shareName, directoryName, prefix, sharesnapshot, marker, maxresults, timeout, this.client.version(), restype, comp, context); } /** * Returns a list of files or directories under the specified share or directory. It lists the contents only for a single level of the directory hierarchy. * + * @param shareName Name of the share. + * @param directoryName Path to the directory. * @param prefix Filters the results to return only entries whose name begins with the specified prefix. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque to the client. @@ -238,32 +312,36 @@ public Mono listFilesAndDirect * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono listFilesAndDirectoriesSegmentWithRestResponseAsync(String prefix, String sharesnapshot, String marker, Integer maxresults, Integer timeout, Context context) { + public Mono listFilesAndDirectoriesSegmentWithRestResponseAsync(String shareName, String directoryName, String prefix, String sharesnapshot, String marker, Integer maxresults, Integer timeout, Context context) { final String restype = "directory"; final String comp = "list"; - return service.listFilesAndDirectoriesSegment(this.client.url(), prefix, sharesnapshot, marker, maxresults, timeout, this.client.version(), restype, comp, context); + return service.listFilesAndDirectoriesSegment(this.client.url(), shareName, directoryName, prefix, sharesnapshot, marker, maxresults, timeout, this.client.version(), restype, comp, context); } /** * Lists handles for directory. * + * @param shareName Name of the share. + * @param directoryName Path to the directory. * @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. */ - public Mono listHandlesWithRestResponseAsync(Context context) { + public Mono listHandlesWithRestResponseAsync(String shareName, String directoryName, Context context) { final String marker = null; final Integer maxresults = null; final Integer timeout = null; final String sharesnapshot = null; final Boolean recursive = null; final String comp = "listhandles"; - return service.listHandles(this.client.url(), marker, maxresults, timeout, sharesnapshot, recursive, this.client.version(), comp, context); + return service.listHandles(this.client.url(), shareName, directoryName, marker, maxresults, timeout, sharesnapshot, recursive, this.client.version(), comp, context); } /** * Lists handles for directory. * + * @param shareName Name of the share. + * @param directoryName Path to the directory. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque to the client. * @param maxresults Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000 items. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. @@ -273,31 +351,35 @@ public Mono listHandlesWithRestResponseAsync(Cont * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono listHandlesWithRestResponseAsync(String marker, Integer maxresults, Integer timeout, String sharesnapshot, Boolean recursive, Context context) { + public Mono listHandlesWithRestResponseAsync(String shareName, String directoryName, String marker, Integer maxresults, Integer timeout, String sharesnapshot, Boolean recursive, Context context) { final String comp = "listhandles"; - return service.listHandles(this.client.url(), marker, maxresults, timeout, sharesnapshot, recursive, this.client.version(), comp, context); + return service.listHandles(this.client.url(), shareName, directoryName, marker, maxresults, timeout, sharesnapshot, recursive, this.client.version(), comp, context); } /** * Closes all handles open for given directory. * + * @param shareName Name of the share. + * @param directoryName Path to the directory. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterix (‘*’) is a wildcard that specifies all handles. * @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. */ - public Mono forceCloseHandlesWithRestResponseAsync(String handleId, Context context) { + public Mono forceCloseHandlesWithRestResponseAsync(String shareName, String directoryName, String handleId, Context context) { final Integer timeout = null; final String marker = null; final String sharesnapshot = null; final Boolean recursive = null; final String comp = "forceclosehandles"; - return service.forceCloseHandles(this.client.url(), timeout, marker, sharesnapshot, handleId, recursive, this.client.version(), comp, context); + return service.forceCloseHandles(this.client.url(), shareName, directoryName, timeout, marker, sharesnapshot, handleId, recursive, this.client.version(), comp, context); } /** * Closes all handles open for given directory. * + * @param shareName Name of the share. + * @param directoryName Path to the directory. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterix (‘*’) is a wildcard that specifies all handles. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque to the client. @@ -307,8 +389,8 @@ public Mono forceCloseHandlesWithRestRespon * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono forceCloseHandlesWithRestResponseAsync(String handleId, Integer timeout, String marker, String sharesnapshot, Boolean recursive, Context context) { + public Mono forceCloseHandlesWithRestResponseAsync(String shareName, String directoryName, String handleId, Integer timeout, String marker, String sharesnapshot, Boolean recursive, Context context) { final String comp = "forceclosehandles"; - return service.forceCloseHandles(this.client.url(), timeout, marker, sharesnapshot, handleId, recursive, this.client.version(), comp, context); + return service.forceCloseHandles(this.client.url(), shareName, directoryName, timeout, marker, sharesnapshot, handleId, recursive, this.client.version(), comp, context); } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/implementation/FilesImpl.java b/storage/client/file/src/main/java/com/azure/storage/file/implementation/FilesImpl.java index ee44ffe4f9830..ad5783b2d1d68 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/implementation/FilesImpl.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/implementation/FilesImpl.java @@ -13,6 +13,7 @@ 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; @@ -61,7 +62,7 @@ public final class FilesImpl { * @param client the instance of the service client containing this operation class. */ public FilesImpl(AzureFileStorageImpl client) { - this.service = RestProxy.create(FilesService.class, client); + this.service = RestProxy.create(FilesService.class, client.httpPipeline()); this.client = client; } @@ -70,77 +71,80 @@ public FilesImpl(AzureFileStorageImpl client) { * proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Files File") + @Service("Storage File Files") private interface FilesService { - @PUT("{shareName}/{directory}/{fileName}") + @PUT("{shareName}/{filePath}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono create(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-content-length") long fileContentLength, @HeaderParam("x-ms-type") String fileTypeConstant, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-content-type") String fileContentType, @HeaderParam("x-ms-content-encoding") String fileContentEncoding, @HeaderParam("x-ms-content-language") String fileContentLanguage, @HeaderParam("x-ms-cache-control") String fileCacheControl, @HeaderParam("x-ms-content-md5") String fileContentMD5, @HeaderParam("x-ms-content-disposition") String fileContentDisposition, Context context); + Mono create(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-content-length") long fileContentLength, @HeaderParam("x-ms-type") String fileTypeConstant, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-content-type") String fileContentType, @HeaderParam("x-ms-content-encoding") String fileContentEncoding, @HeaderParam("x-ms-content-language") String fileContentLanguage, @HeaderParam("x-ms-cache-control") String fileCacheControl, @HeaderParam("x-ms-content-md5") String fileContentMD5, @HeaderParam("x-ms-content-disposition") String fileContentDisposition, Context context); - @GET("{shareName}/{directory}/{fileName}") + @GET("{shareName}/{filePath}") @ExpectedResponses({200, 206}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono download(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-range-get-content-md5") Boolean rangeGetContentMD5, Context context); + Mono download(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-range-get-content-md5") Boolean rangeGetContentMD5, Context context); - @HEAD("{shareName}/{directory}/{fileName}") + @HEAD("{shareName}/{filePath}") @ExpectedResponses({200}) - Mono getProperties(@HostParam("url") String url, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, Context context); + @UnexpectedResponseExceptionType(StorageErrorException.class) + Mono getProperties(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, Context context); - @DELETE("{shareName}/{directory}/{fileName}") + @DELETE("{shareName}/{filePath}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono delete(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, Context context); + Mono delete(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, Context context); - @PUT("{shareName}/{directory}/{fileName}") + @PUT("{shareName}/{filePath}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setHTTPHeaders(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-content-length") Long fileContentLength, @QueryParam("comp") String comp, @HeaderParam("x-ms-content-type") String fileContentType, @HeaderParam("x-ms-content-encoding") String fileContentEncoding, @HeaderParam("x-ms-content-language") String fileContentLanguage, @HeaderParam("x-ms-cache-control") String fileCacheControl, @HeaderParam("x-ms-content-md5") String fileContentMD5, @HeaderParam("x-ms-content-disposition") String fileContentDisposition, Context context); + Mono setHTTPHeaders(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-content-length") Long fileContentLength, @QueryParam("comp") String comp, @HeaderParam("x-ms-content-type") String fileContentType, @HeaderParam("x-ms-content-encoding") String fileContentEncoding, @HeaderParam("x-ms-content-language") String fileContentLanguage, @HeaderParam("x-ms-cache-control") String fileCacheControl, @HeaderParam("x-ms-content-md5") String fileContentMD5, @HeaderParam("x-ms-content-disposition") String fileContentDisposition, Context context); - @PUT("{shareName}/{directory}/{fileName}") + @PUT("{shareName}/{filePath}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setMetadata(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); + Mono setMetadata(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); - @PUT("{shareName}/{directory}/{fileName}") + @PUT("{shareName}/{filePath}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono uploadRange(@HostParam("url") String url, @BodyParam("application/octet-stream") Flux optionalbody, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-write") FileRangeWriteType fileRangeWrite, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String contentMD5, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); + Mono uploadRange(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @BodyParam("application/octet-stream") Flux optionalbody, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-write") FileRangeWriteType fileRangeWrite, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String contentMD5, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); - @GET("{shareName}/{directory}/{fileName}") + @GET("{shareName}/{filePath}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getRangeList(@HostParam("url") String url, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-range") String range, @QueryParam("comp") String comp, Context context); + Mono getRangeList(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-range") String range, @QueryParam("comp") String comp, Context context); - @PUT("{shareName}/{directory}/{fileName}") + @PUT("{shareName}/{filePath}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono startCopy(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-copy-source") String copySource, Context context); + Mono startCopy(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-copy-source") String copySource, Context context); - @PUT("{shareName}/{directory}/{fileName}") + @PUT("{shareName}/{filePath}") @ExpectedResponses({204}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono abortCopy(@HostParam("url") String url, @QueryParam("copyid") String copyId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-copy-action") String copyActionAbortConstant, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); + Mono abortCopy(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("copyid") String copyId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-copy-action") String copyActionAbortConstant, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); - @GET("{shareName}/{directory}/{fileName}") + @GET("{shareName}/{filePath}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono listHandles(@HostParam("url") String url, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("timeout") Integer timeout, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); + Mono listHandles(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("timeout") Integer timeout, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); - @PUT("{shareName}/{directory}/{fileName}") + @PUT("{shareName}/{filePath}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono forceCloseHandles(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @QueryParam("marker") String marker, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-handle-id") String handleId, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); + Mono forceCloseHandles(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("timeout") Integer timeout, @QueryParam("marker") String marker, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-handle-id") String handleId, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); } /** * Creates a new file or replaces a file. Note it only initializes the file with no content. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @param fileContentLength Specifies the maximum size for the file, up to 1 TB. * @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. */ - public Mono createWithRestResponseAsync(long fileContentLength, Context context) { + public Mono createWithRestResponseAsync(String shareName, String filePath, long fileContentLength, Context context) { final Integer timeout = null; final String fileTypeConstant = "file"; final Map metadata = null; @@ -150,12 +154,14 @@ public Mono createWithRestResponseAsync(long fileContentLen final String fileCacheControl = null; final String fileContentDisposition = null; String fileContentMD5Converted = null; - return service.create(this.client.url(), timeout, this.client.version(), fileContentLength, fileTypeConstant, metadata, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); + return service.create(this.client.url(), shareName, filePath, timeout, this.client.version(), fileContentLength, fileTypeConstant, metadata, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); } /** * Creates a new file or replaces a file. Note it only initializes the file with no content. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @param fileContentLength Specifies the maximum size for the file, up to 1 TB. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param metadata A name-value pair to associate with a file storage object. @@ -164,7 +170,7 @@ public Mono createWithRestResponseAsync(long fileContentLen * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono createWithRestResponseAsync(long fileContentLength, Integer timeout, Map metadata, FileHTTPHeaders fileHTTPHeaders, Context context) { + public Mono createWithRestResponseAsync(String shareName, String filePath, long fileContentLength, Integer timeout, Map metadata, FileHTTPHeaders fileHTTPHeaders, Context context) { final String fileTypeConstant = "file"; String fileContentType = null; if (fileHTTPHeaders != null) { @@ -191,26 +197,30 @@ public Mono createWithRestResponseAsync(long fileContentLen fileContentDisposition = fileHTTPHeaders.fileContentDisposition(); } String fileContentMD5Converted = Base64Util.encodeToString(fileContentMD5); - return service.create(this.client.url(), timeout, this.client.version(), fileContentLength, fileTypeConstant, metadata, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); + return service.create(this.client.url(), shareName, filePath, timeout, this.client.version(), fileContentLength, fileTypeConstant, metadata, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); } /** * Reads or downloads a file from the system, including its metadata and properties. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @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. */ - public Mono downloadWithRestResponseAsync(Context context) { + public Mono downloadWithRestResponseAsync(String shareName, String filePath, Context context) { final Integer timeout = null; final String range = null; final Boolean rangeGetContentMD5 = null; - return service.download(this.client.url(), timeout, this.client.version(), range, rangeGetContentMD5, context); + return service.download(this.client.url(), shareName, filePath, timeout, this.client.version(), range, rangeGetContentMD5, context); } /** * Reads or downloads a file from the system, including its metadata and properties. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param range Return file data only from the specified byte range. * @param rangeGetContentMD5 When this header is set to true and specified together with the Range header, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size. @@ -218,68 +228,78 @@ public Mono downloadWithRestResponseAsync(Context context * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono downloadWithRestResponseAsync(Integer timeout, String range, Boolean rangeGetContentMD5, Context context) { - return service.download(this.client.url(), timeout, this.client.version(), range, rangeGetContentMD5, context); + public Mono downloadWithRestResponseAsync(String shareName, String filePath, Integer timeout, String range, Boolean rangeGetContentMD5, Context context) { + return service.download(this.client.url(), shareName, filePath, timeout, this.client.version(), range, rangeGetContentMD5, context); } /** * Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not return the content of the file. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @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. */ - public Mono getPropertiesWithRestResponseAsync(Context context) { + public Mono getPropertiesWithRestResponseAsync(String shareName, String filePath, Context context) { final String sharesnapshot = null; final Integer timeout = null; - return service.getProperties(this.client.url(), sharesnapshot, timeout, this.client.version(), context); + return service.getProperties(this.client.url(), shareName, filePath, sharesnapshot, timeout, this.client.version(), context); } /** * Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not return the content of the file. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @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. */ - public Mono getPropertiesWithRestResponseAsync(String sharesnapshot, Integer timeout, Context context) { - return service.getProperties(this.client.url(), sharesnapshot, timeout, this.client.version(), context); + public Mono getPropertiesWithRestResponseAsync(String shareName, String filePath, String sharesnapshot, Integer timeout, Context context) { + return service.getProperties(this.client.url(), shareName, filePath, sharesnapshot, timeout, this.client.version(), context); } /** * removes the file from the storage account. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @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. */ - public Mono deleteWithRestResponseAsync(Context context) { + public Mono deleteWithRestResponseAsync(String shareName, String filePath, Context context) { final Integer timeout = null; - return service.delete(this.client.url(), timeout, this.client.version(), context); + return service.delete(this.client.url(), shareName, filePath, timeout, this.client.version(), context); } /** * removes the file from the storage account. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @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. */ - public Mono deleteWithRestResponseAsync(Integer timeout, Context context) { - return service.delete(this.client.url(), timeout, this.client.version(), context); + public Mono deleteWithRestResponseAsync(String shareName, String filePath, Integer timeout, Context context) { + return service.delete(this.client.url(), shareName, filePath, timeout, this.client.version(), context); } /** * Sets HTTP headers on the file. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @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. */ - public Mono setHTTPHeadersWithRestResponseAsync(Context context) { + public Mono setHTTPHeadersWithRestResponseAsync(String shareName, String filePath, Context context) { final Integer timeout = null; final Long fileContentLength = null; final String comp = "properties"; @@ -289,12 +309,14 @@ public Mono setHTTPHeadersWithRestResponseAsync(Con final String fileCacheControl = null; final String fileContentDisposition = null; String fileContentMD5Converted = null; - return service.setHTTPHeaders(this.client.url(), timeout, this.client.version(), fileContentLength, comp, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); + return service.setHTTPHeaders(this.client.url(), shareName, filePath, timeout, this.client.version(), fileContentLength, comp, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); } /** * Sets HTTP headers on the file. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param fileContentLength Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are cleared. * @param fileHTTPHeaders Additional parameters for the operation. @@ -302,7 +324,7 @@ public Mono setHTTPHeadersWithRestResponseAsync(Con * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono setHTTPHeadersWithRestResponseAsync(Integer timeout, Long fileContentLength, FileHTTPHeaders fileHTTPHeaders, Context context) { + public Mono setHTTPHeadersWithRestResponseAsync(String shareName, String filePath, Integer timeout, Long fileContentLength, FileHTTPHeaders fileHTTPHeaders, Context context) { final String comp = "properties"; String fileContentType = null; if (fileHTTPHeaders != null) { @@ -329,40 +351,46 @@ public Mono setHTTPHeadersWithRestResponseAsync(Int fileContentDisposition = fileHTTPHeaders.fileContentDisposition(); } String fileContentMD5Converted = Base64Util.encodeToString(fileContentMD5); - return service.setHTTPHeaders(this.client.url(), timeout, this.client.version(), fileContentLength, comp, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); + return service.setHTTPHeaders(this.client.url(), shareName, filePath, timeout, this.client.version(), fileContentLength, comp, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); } /** * Updates user-defined metadata for the specified file. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @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. */ - public Mono setMetadataWithRestResponseAsync(Context context) { + public Mono setMetadataWithRestResponseAsync(String shareName, String filePath, Context context) { final Integer timeout = null; final Map metadata = null; final String comp = "metadata"; - return service.setMetadata(this.client.url(), timeout, metadata, this.client.version(), comp, context); + return service.setMetadata(this.client.url(), shareName, filePath, timeout, metadata, this.client.version(), comp, context); } /** * Updates user-defined metadata for the specified file. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param metadata A name-value pair to associate with a file storage object. * @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. */ - public Mono setMetadataWithRestResponseAsync(Integer timeout, Map metadata, Context context) { + public Mono setMetadataWithRestResponseAsync(String shareName, String filePath, Integer timeout, Map metadata, Context context) { final String comp = "metadata"; - return service.setMetadata(this.client.url(), timeout, metadata, this.client.version(), comp, context); + return service.setMetadata(this.client.url(), shareName, filePath, timeout, metadata, this.client.version(), comp, context); } /** * Upload a range of bytes to a file. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. For an update operation, the range can be up to 4 MB in size. For a clear operation, the range can be up to the value of the file's full size. The File service accepts only a single byte range for the Range and 'x-ms-range' headers, and the byte range must be specified in the following format: bytes=startByte-endByte. * @param fileRangeWrite Specify one of the following options: - Update: Writes the bytes specified by the request body into the specified range. The Range and Content-Length headers must match to perform the update. - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and set the Range header to a value that indicates the range to clear, up to maximum file size. Possible values include: 'update', 'clear'. * @param contentLength Specifies the number of bytes being transmitted in the request body. When the x-ms-write header is set to clear, the value of this header must be set to zero. @@ -370,17 +398,19 @@ public Mono setMetadataWithRestResponseAsync(Integer t * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono uploadRangeWithRestResponseAsync(String range, FileRangeWriteType fileRangeWrite, long contentLength, Context context) { + public Mono uploadRangeWithRestResponseAsync(String shareName, String filePath, String range, FileRangeWriteType fileRangeWrite, long contentLength, Context context) { final Flux optionalbody = null; final Integer timeout = null; final String comp = "range"; String contentMD5Converted = null; - return service.uploadRange(this.client.url(), optionalbody, timeout, range, fileRangeWrite, contentLength, contentMD5Converted, this.client.version(), comp, context); + return service.uploadRange(this.client.url(), shareName, filePath, optionalbody, timeout, range, fileRangeWrite, contentLength, contentMD5Converted, this.client.version(), comp, context); } /** * Upload a range of bytes to a file. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. For an update operation, the range can be up to 4 MB in size. For a clear operation, the range can be up to the value of the file's full size. The File service accepts only a single byte range for the Range and 'x-ms-range' headers, and the byte range must be specified in the following format: bytes=startByte-endByte. * @param fileRangeWrite Specify one of the following options: - Update: Writes the bytes specified by the request body into the specified range. The Range and Content-Length headers must match to perform the update. - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and set the Range header to a value that indicates the range to clear, up to maximum file size. Possible values include: 'update', 'clear'. * @param contentLength Specifies the number of bytes being transmitted in the request body. When the x-ms-write header is set to clear, the value of this header must be set to zero. @@ -391,30 +421,34 @@ public Mono uploadRangeWithRestResponseAsync(String ra * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono uploadRangeWithRestResponseAsync(String range, FileRangeWriteType fileRangeWrite, long contentLength, Flux optionalbody, Integer timeout, byte[] contentMD5, Context context) { + public Mono uploadRangeWithRestResponseAsync(String shareName, String filePath, String range, FileRangeWriteType fileRangeWrite, long contentLength, Flux optionalbody, Integer timeout, byte[] contentMD5, Context context) { final String comp = "range"; String contentMD5Converted = Base64Util.encodeToString(contentMD5); - return service.uploadRange(this.client.url(), optionalbody, timeout, range, fileRangeWrite, contentLength, contentMD5Converted, this.client.version(), comp, context); + return service.uploadRange(this.client.url(), shareName, filePath, optionalbody, timeout, range, fileRangeWrite, contentLength, contentMD5Converted, this.client.version(), comp, context); } /** * Returns the list of valid ranges for a file. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @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. */ - public Mono getRangeListWithRestResponseAsync(Context context) { + public Mono getRangeListWithRestResponseAsync(String shareName, String filePath, Context context) { final String sharesnapshot = null; final Integer timeout = null; final String range = null; final String comp = "rangelist"; - return service.getRangeList(this.client.url(), sharesnapshot, timeout, this.client.version(), range, comp, context); + return service.getRangeList(this.client.url(), shareName, filePath, sharesnapshot, timeout, this.client.version(), range, comp, context); } /** * Returns the list of valid ranges for a file. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param range Specifies the range of bytes over which to list ranges, inclusively. @@ -422,28 +456,32 @@ public Mono getRangeListWithRestResponseAsync(Context * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono getRangeListWithRestResponseAsync(String sharesnapshot, Integer timeout, String range, Context context) { + public Mono getRangeListWithRestResponseAsync(String shareName, String filePath, String sharesnapshot, Integer timeout, String range, Context context) { final String comp = "rangelist"; - return service.getRangeList(this.client.url(), sharesnapshot, timeout, this.client.version(), range, comp, context); + return service.getRangeList(this.client.url(), shareName, filePath, sharesnapshot, timeout, this.client.version(), range, comp, context); } /** * Copies a blob or file to a destination file within the storage account. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @param copySource Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another file within the same storage account, you may use Shared Key to authenticate the source file. If you are copying a file from another storage account, or if you are copying a blob from the same storage account or another storage account, then you must authenticate the source file or blob using a shared access signature. If the source is a public blob, no authentication is required to perform the copy operation. A file in a share snapshot can also be specified as a copy source. * @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. */ - public Mono startCopyWithRestResponseAsync(String copySource, Context context) { + public Mono startCopyWithRestResponseAsync(String shareName, String filePath, String copySource, Context context) { final Integer timeout = null; final Map metadata = null; - return service.startCopy(this.client.url(), timeout, this.client.version(), metadata, copySource, context); + return service.startCopy(this.client.url(), shareName, filePath, timeout, this.client.version(), metadata, copySource, context); } /** * Copies a blob or file to a destination file within the storage account. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @param copySource Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another file within the same storage account, you may use Shared Key to authenticate the source file. If you are copying a file from another storage account, or if you are copying a blob from the same storage account or another storage account, then you must authenticate the source file or blob using a shared access signature. If the source is a public blob, no authentication is required to perform the copy operation. A file in a share snapshot can also be specified as a copy source. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param metadata A name-value pair to associate with a file storage object. @@ -451,59 +489,67 @@ public Mono startCopyWithRestResponseAsync(String copySo * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono startCopyWithRestResponseAsync(String copySource, Integer timeout, Map metadata, Context context) { - return service.startCopy(this.client.url(), timeout, this.client.version(), metadata, copySource, context); + public Mono startCopyWithRestResponseAsync(String shareName, String filePath, String copySource, Integer timeout, Map metadata, Context context) { + return service.startCopy(this.client.url(), shareName, filePath, timeout, this.client.version(), metadata, copySource, context); } /** * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy File operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono abortCopyWithRestResponseAsync(String copyId, Context context) { + public Mono abortCopyWithRestResponseAsync(String shareName, String filePath, String copyId, Context context) { final Integer timeout = null; final String copyActionAbortConstant = "abort"; final String comp = "copy"; - return service.abortCopy(this.client.url(), copyId, timeout, copyActionAbortConstant, this.client.version(), comp, context); + return service.abortCopy(this.client.url(), shareName, filePath, copyId, timeout, copyActionAbortConstant, this.client.version(), comp, context); } /** * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy File operation. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @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. */ - public Mono abortCopyWithRestResponseAsync(String copyId, Integer timeout, Context context) { + public Mono abortCopyWithRestResponseAsync(String shareName, String filePath, String copyId, Integer timeout, Context context) { final String copyActionAbortConstant = "abort"; final String comp = "copy"; - return service.abortCopy(this.client.url(), copyId, timeout, copyActionAbortConstant, this.client.version(), comp, context); + return service.abortCopy(this.client.url(), shareName, filePath, copyId, timeout, copyActionAbortConstant, this.client.version(), comp, context); } /** * Lists handles for file. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @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. */ - public Mono listHandlesWithRestResponseAsync(Context context) { + public Mono listHandlesWithRestResponseAsync(String shareName, String filePath, Context context) { final String marker = null; final Integer maxresults = null; final Integer timeout = null; final String sharesnapshot = null; final String comp = "listhandles"; - return service.listHandles(this.client.url(), marker, maxresults, timeout, sharesnapshot, this.client.version(), comp, context); + return service.listHandles(this.client.url(), shareName, filePath, marker, maxresults, timeout, sharesnapshot, this.client.version(), comp, context); } /** * Lists handles for file. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque to the client. * @param maxresults Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000 items. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. @@ -512,30 +558,34 @@ public Mono listHandlesWithRestResponseAsync(Context c * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono listHandlesWithRestResponseAsync(String marker, Integer maxresults, Integer timeout, String sharesnapshot, Context context) { + public Mono listHandlesWithRestResponseAsync(String shareName, String filePath, String marker, Integer maxresults, Integer timeout, String sharesnapshot, Context context) { final String comp = "listhandles"; - return service.listHandles(this.client.url(), marker, maxresults, timeout, sharesnapshot, this.client.version(), comp, context); + return service.listHandles(this.client.url(), shareName, filePath, marker, maxresults, timeout, sharesnapshot, this.client.version(), comp, context); } /** * Closes all handles open for given file. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterix (‘*’) is a wildcard that specifies all handles. * @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. */ - public Mono forceCloseHandlesWithRestResponseAsync(String handleId, Context context) { + public Mono forceCloseHandlesWithRestResponseAsync(String shareName, String filePath, String handleId, Context context) { final Integer timeout = null; final String marker = null; final String sharesnapshot = null; final String comp = "forceclosehandles"; - return service.forceCloseHandles(this.client.url(), timeout, marker, sharesnapshot, handleId, this.client.version(), comp, context); + return service.forceCloseHandles(this.client.url(), shareName, filePath, timeout, marker, sharesnapshot, handleId, this.client.version(), comp, context); } /** * Closes all handles open for given file. * + * @param shareName Name of the share. + * @param filePath Path to the file. * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterix (‘*’) is a wildcard that specifies all handles. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param marker A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque to the client. @@ -544,8 +594,8 @@ public Mono forceCloseHandlesWithRestResponseAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono forceCloseHandlesWithRestResponseAsync(String handleId, Integer timeout, String marker, String sharesnapshot, Context context) { + public Mono forceCloseHandlesWithRestResponseAsync(String shareName, String filePath, String handleId, Integer timeout, String marker, String sharesnapshot, Context context) { final String comp = "forceclosehandles"; - return service.forceCloseHandles(this.client.url(), timeout, marker, sharesnapshot, handleId, this.client.version(), comp, context); + return service.forceCloseHandles(this.client.url(), shareName, filePath, timeout, marker, sharesnapshot, handleId, this.client.version(), comp, context); } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/implementation/ServicesImpl.java b/storage/client/file/src/main/java/com/azure/storage/file/implementation/ServicesImpl.java index 5fcf68a794327..d2fc21cb7b595 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/implementation/ServicesImpl.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/implementation/ServicesImpl.java @@ -18,14 +18,15 @@ import com.azure.core.implementation.RestProxy; import com.azure.core.implementation.serializer.jackson.JacksonAdapter; import com.azure.core.util.Context; +import com.azure.storage.file.models.FileServiceProperties; import com.azure.storage.file.models.ListSharesIncludeType; import com.azure.storage.file.models.ServicesGetPropertiesResponse; import com.azure.storage.file.models.ServicesListSharesSegmentResponse; import com.azure.storage.file.models.ServicesSetPropertiesResponse; import com.azure.storage.file.models.StorageErrorException; -import com.azure.storage.file.models.StorageServiceProperties; import reactor.core.publisher.Mono; + import java.util.List; /** @@ -49,7 +50,7 @@ public final class ServicesImpl { * @param client the instance of the service client containing this operation class. */ public ServicesImpl(AzureFileStorageImpl client) { - this.service = RestProxy.create(ServicesService.class, client); + this.service = RestProxy.create(ServicesService.class, client.httpPipeline()); this.client = client; } @@ -58,12 +59,12 @@ public ServicesImpl(AzureFileStorageImpl client) { * proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Files Service") + @Service("Storage File Services") private interface ServicesService { @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, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + Mono setProperties(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") FileServiceProperties fileServiceProperties, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @GET("") @ExpectedResponses({200}) @@ -79,31 +80,31 @@ private interface ServicesService { /** * Sets properties for a storage account's File service endpoint, including properties for Storage Analytics metrics and CORS (Cross-Origin Resource Sharing) rules. * - * @param storageServiceProperties The StorageService properties. + * @param fileServiceProperties The FileService 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. */ - public Mono setPropertiesWithRestResponseAsync(StorageServiceProperties storageServiceProperties, Context context) { + public Mono setPropertiesWithRestResponseAsync(FileServiceProperties fileServiceProperties, Context context) { final Integer timeout = null; final String restype = "service"; final String comp = "properties"; - return service.setProperties(this.client.url(), storageServiceProperties, timeout, this.client.version(), restype, comp, context); + return service.setProperties(this.client.url(), fileServiceProperties, timeout, this.client.version(), restype, comp, context); } /** * Sets properties for a storage account's File service endpoint, including properties for Storage Analytics metrics and CORS (Cross-Origin Resource Sharing) rules. * - * @param storageServiceProperties The StorageService properties. + * @param fileServiceProperties The FileService properties. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @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. */ - public Mono setPropertiesWithRestResponseAsync(StorageServiceProperties storageServiceProperties, Integer timeout, Context context) { + public Mono setPropertiesWithRestResponseAsync(FileServiceProperties fileServiceProperties, Integer timeout, Context context) { final String restype = "service"; final String comp = "properties"; - return service.setProperties(this.client.url(), storageServiceProperties, timeout, this.client.version(), restype, comp, context); + return service.setProperties(this.client.url(), fileServiceProperties, timeout, this.client.version(), restype, comp, context); } /** diff --git a/storage/client/file/src/main/java/com/azure/storage/file/implementation/SharesImpl.java b/storage/client/file/src/main/java/com/azure/storage/file/implementation/SharesImpl.java index bdc5fbadff999..befdb6335b90d 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/implementation/SharesImpl.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/implementation/SharesImpl.java @@ -12,6 +12,7 @@ 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; @@ -29,9 +30,8 @@ import com.azure.storage.file.models.SharesSetQuotaResponse; import com.azure.storage.file.models.SignedIdentifier; import com.azure.storage.file.models.StorageErrorException; -import reactor.core.publisher.Mono; - import java.util.List; +import reactor.core.publisher.Mono; import java.util.Map; /** @@ -64,72 +64,74 @@ public SharesImpl(AzureFileStorageImpl client) { * proxy service to perform REST calls. */ @Host("{url}") - @Service("Storage Files Shares") + @Service("Storage File Shares") private interface SharesService { @PUT("{shareName}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono create(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-share-quota") Integer quota, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); + Mono create(@HostParam("url") String url, @PathParam ("shareName") String shareName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-share-quota") Integer quota, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); @GET("{shareName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getProperties(@HostParam("url") String url, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); + Mono getProperties(@HostParam("url") String url, @PathParam ("shareName") String shareName, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); @DELETE("{shareName}") @ExpectedResponses({202}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono delete(@HostParam("url") String url, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-delete-snapshots") DeleteSnapshotsOptionType deleteSnapshots, @QueryParam("restype") String restype, Context context); + Mono delete(@HostParam("url") String url, @PathParam ("shareName") String shareName, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-delete-snapshots") DeleteSnapshotsOptionType deleteSnapshots, @QueryParam("restype") String restype, Context context); @PUT("{shareName}") @ExpectedResponses({201}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono createSnapshot(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + Mono createSnapshot(@HostParam("url") String url, @PathParam ("shareName") String shareName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @PUT("{shareName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setQuota(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-share-quota") Integer quota, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + Mono setQuota(@HostParam("url") String url, @PathParam ("shareName") String shareName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-share-quota") Integer quota, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @PUT("{shareName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setMetadata(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + Mono setMetadata(@HostParam("url") String url, @PathParam ("shareName") String shareName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @GET("{shareName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getAccessPolicy(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + Mono getAccessPolicy(@HostParam("url") String url, @PathParam ("shareName") String shareName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @PUT("{shareName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setAccessPolicy(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") SignedIdentifiersWrapper shareAcl, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + Mono setAccessPolicy(@HostParam("url") String url, @PathParam ("shareName") String shareName, @BodyParam("application/xml; charset=utf-8") SignedIdentifiersWrapper shareAcl, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); @GET("{shareName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getStatistics(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); + Mono getStatistics(@HostParam("url") String url, @PathParam ("shareName") String shareName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); } /** * Creates a new share under the specified account. If the share with the same name already exists, the operation fails. * + * @param shareName The name of the share to create. * @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. */ - public Mono createWithRestResponseAsync(Context context) { + public Mono createWithRestResponseAsync(String shareName, Context context) { final Integer timeout = null; final Map metadata = null; final Integer quota = null; final String restype = "share"; - return service.create(this.client.url(), timeout, metadata, quota, this.client.version(), restype, context); + return service.create(this.client.url(), shareName, timeout, metadata, quota, this.client.version(), restype, context); } /** * Creates a new share under the specified account. If the share with the same name already exists, the operation fails. * + * @param shareName The name of the share to create. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param metadata A name-value pair to associate with a file storage object. * @param quota Specifies the maximum size of the share, in gigabytes. @@ -137,57 +139,61 @@ public Mono createWithRestResponseAsync(Context context) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono createWithRestResponseAsync(Integer timeout, Map metadata, Integer quota, Context context) { + public Mono createWithRestResponseAsync(String shareName, Integer timeout, Map metadata, Integer quota, Context context) { final String restype = "share"; - return service.create(this.client.url(), timeout, metadata, quota, this.client.version(), restype, context); + return service.create(this.client.url(), shareName, timeout, metadata, quota, this.client.version(), restype, context); } /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data returned does not include the share's list of files. * + * @param shareName The name of the share that is having its properties retrieved. * @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. */ - public Mono getPropertiesWithRestResponseAsync(Context context) { + public Mono getPropertiesWithRestResponseAsync(String shareName, Context context) { final String sharesnapshot = null; final Integer timeout = null; final String restype = "share"; - return service.getProperties(this.client.url(), sharesnapshot, timeout, this.client.version(), restype, context); + return service.getProperties(this.client.url(), shareName, sharesnapshot, timeout, this.client.version(), restype, context); } /** * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data returned does not include the share's list of files. * + * @param shareName The name of the share that is having its properties retrieved. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @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. */ - public Mono getPropertiesWithRestResponseAsync(String sharesnapshot, Integer timeout, Context context) { + public Mono getPropertiesWithRestResponseAsync(String shareName, String sharesnapshot, Integer timeout, Context context) { final String restype = "share"; - return service.getProperties(this.client.url(), sharesnapshot, timeout, this.client.version(), restype, context); + return service.getProperties(this.client.url(), shareName, sharesnapshot, timeout, this.client.version(), restype, context); } /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files contained within it are later deleted during garbage collection. * + * @param shareName The name of the share to delete. * @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. */ - public Mono deleteWithRestResponseAsync(Context context) { + public Mono deleteWithRestResponseAsync(String shareName, Context context) { final String sharesnapshot = null; final Integer timeout = null; final DeleteSnapshotsOptionType deleteSnapshots = null; final String restype = "share"; - return service.delete(this.client.url(), sharesnapshot, timeout, this.client.version(), deleteSnapshots, restype, context); + return service.delete(this.client.url(), shareName, sharesnapshot, timeout, this.client.version(), deleteSnapshots, restype, context); } /** * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files contained within it are later deleted during garbage collection. * + * @param shareName The name of the share to delete. * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param deleteSnapshots Specifies the option include to delete the base share and all of its snapshots. Possible values include: 'include'. @@ -195,185 +201,197 @@ public Mono deleteWithRestResponseAsync(Context context) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @return a Mono which performs the network request upon subscription. */ - public Mono deleteWithRestResponseAsync(String sharesnapshot, Integer timeout, DeleteSnapshotsOptionType deleteSnapshots, Context context) { + public Mono deleteWithRestResponseAsync(String shareName, String sharesnapshot, Integer timeout, DeleteSnapshotsOptionType deleteSnapshots, Context context) { final String restype = "share"; - return service.delete(this.client.url(), sharesnapshot, timeout, this.client.version(), deleteSnapshots, restype, context); + return service.delete(this.client.url(), shareName, sharesnapshot, timeout, this.client.version(), deleteSnapshots, restype, context); } /** * Creates a read-only snapshot of a share. * + * @param shareName The name of the share that is having a snapshot created. * @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. */ - public Mono createSnapshotWithRestResponseAsync(Context context) { + public Mono createSnapshotWithRestResponseAsync(String shareName, Context context) { final Integer timeout = null; final Map metadata = null; final String restype = "share"; final String comp = "snapshot"; - return service.createSnapshot(this.client.url(), timeout, metadata, this.client.version(), restype, comp, context); + return service.createSnapshot(this.client.url(), shareName, timeout, metadata, this.client.version(), restype, comp, context); } /** * Creates a read-only snapshot of a share. * + * @param shareName The name of the share that is having a snapshot created. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param metadata A name-value pair to associate with a file storage object. * @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. */ - public Mono createSnapshotWithRestResponseAsync(Integer timeout, Map metadata, Context context) { + public Mono createSnapshotWithRestResponseAsync(String shareName, Integer timeout, Map metadata, Context context) { final String restype = "share"; final String comp = "snapshot"; - return service.createSnapshot(this.client.url(), timeout, metadata, this.client.version(), restype, comp, context); + return service.createSnapshot(this.client.url(), shareName, timeout, metadata, this.client.version(), restype, comp, context); } /** * Sets quota for the specified share. * + * @param shareName The name of the share that is having its quota set. * @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. */ - public Mono setQuotaWithRestResponseAsync(Context context) { + public Mono setQuotaWithRestResponseAsync(String shareName, Context context) { final Integer timeout = null; final Integer quota = null; final String restype = "share"; final String comp = "properties"; - return service.setQuota(this.client.url(), timeout, this.client.version(), quota, restype, comp, context); + return service.setQuota(this.client.url(), shareName, timeout, this.client.version(), quota, restype, comp, context); } /** * Sets quota for the specified share. * + * @param shareName The name of the share that is having its quota set. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param quota Specifies the maximum size of the share, in gigabytes. * @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. */ - public Mono setQuotaWithRestResponseAsync(Integer timeout, Integer quota, Context context) { + public Mono setQuotaWithRestResponseAsync(String shareName, Integer timeout, Integer quota, Context context) { final String restype = "share"; final String comp = "properties"; - return service.setQuota(this.client.url(), timeout, this.client.version(), quota, restype, comp, context); + return service.setQuota(this.client.url(), shareName, timeout, this.client.version(), quota, restype, comp, context); } /** * Sets one or more user-defined name-value pairs for the specified share. * + * @param shareName The name of the share having its metadata set. * @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. */ - public Mono setMetadataWithRestResponseAsync(Context context) { + public Mono setMetadataWithRestResponseAsync(String shareName, Context context) { final Integer timeout = null; final Map metadata = null; final String restype = "share"; final String comp = "metadata"; - return service.setMetadata(this.client.url(), timeout, metadata, this.client.version(), restype, comp, context); + return service.setMetadata(this.client.url(), shareName, timeout, metadata, this.client.version(), restype, comp, context); } /** * Sets one or more user-defined name-value pairs for the specified share. * + * @param shareName The name of the share having its metadata set. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @param metadata A name-value pair to associate with a file storage object. * @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. */ - public Mono setMetadataWithRestResponseAsync(Integer timeout, Map metadata, Context context) { + public Mono setMetadataWithRestResponseAsync(String shareName, Integer timeout, Map metadata, Context context) { final String restype = "share"; final String comp = "metadata"; - return service.setMetadata(this.client.url(), timeout, metadata, this.client.version(), restype, comp, context); + return service.setMetadata(this.client.url(), shareName, timeout, metadata, this.client.version(), restype, comp, context); } /** * Returns information about stored access policies specified on the share. * + * @param shareName The name of the share having its access policy retrieved. * @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. */ - public Mono getAccessPolicyWithRestResponseAsync(Context context) { + public Mono getAccessPolicyWithRestResponseAsync(String shareName, Context context) { final Integer timeout = null; final String restype = "share"; final String comp = "acl"; - return service.getAccessPolicy(this.client.url(), timeout, this.client.version(), restype, comp, context); + return service.getAccessPolicy(this.client.url(), shareName, timeout, this.client.version(), restype, comp, context); } /** * Returns information about stored access policies specified on the share. * + * @param shareName The name of the share having its access policy retrieved. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @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. */ - public Mono getAccessPolicyWithRestResponseAsync(Integer timeout, Context context) { + public Mono getAccessPolicyWithRestResponseAsync(String shareName, Integer timeout, Context context) { final String restype = "share"; final String comp = "acl"; - return service.getAccessPolicy(this.client.url(), timeout, this.client.version(), restype, comp, context); + return service.getAccessPolicy(this.client.url(), shareName, timeout, this.client.version(), restype, comp, context); } /** * Sets a stored access policy for use with shared access signatures. * + * @param shareName The name of the share having its access policy set. * @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. */ - public Mono setAccessPolicyWithRestResponseAsync(Context context) { + public Mono setAccessPolicyWithRestResponseAsync(String shareName, Context context) { final Integer timeout = null; final String restype = "share"; final String comp = "acl"; SignedIdentifiersWrapper shareAclConverted = new SignedIdentifiersWrapper(null); - return service.setAccessPolicy(this.client.url(), shareAclConverted, timeout, this.client.version(), restype, comp, context); + return service.setAccessPolicy(this.client.url(), shareName, shareAclConverted, timeout, this.client.version(), restype, comp, context); } /** * Sets a stored access policy for use with shared access signatures. * + * @param shareName The name of the share having its access policy set. * @param shareAcl The ACL for the share. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @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. */ - public Mono setAccessPolicyWithRestResponseAsync(List shareAcl, Integer timeout, Context context) { + public Mono setAccessPolicyWithRestResponseAsync(String shareName, List shareAcl, Integer timeout, Context context) { final String restype = "share"; final String comp = "acl"; SignedIdentifiersWrapper shareAclConverted = new SignedIdentifiersWrapper(shareAcl); - return service.setAccessPolicy(this.client.url(), shareAclConverted, timeout, this.client.version(), restype, comp, context); + return service.setAccessPolicy(this.client.url(), shareName, shareAclConverted, timeout, this.client.version(), restype, comp, context); } /** * Retrieves statistics related to the share. * + * @param shareName The name of the share having its statistics retrieved. * @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. */ - public Mono getStatisticsWithRestResponseAsync(Context context) { + public Mono getStatisticsWithRestResponseAsync(String shareName, Context context) { final Integer timeout = null; final String restype = "share"; final String comp = "stats"; - return service.getStatistics(this.client.url(), timeout, this.client.version(), restype, comp, context); + return service.getStatistics(this.client.url(), shareName, timeout, this.client.version(), restype, comp, context); } /** * Retrieves statistics related to the share. * + * @param shareName The name of the share having its statistics retrieved. * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. * @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. */ - public Mono getStatisticsWithRestResponseAsync(Integer timeout, Context context) { + public Mono getStatisticsWithRestResponseAsync(String shareName, Integer timeout, Context context) { final String restype = "share"; final String comp = "stats"; - return service.getStatistics(this.client.url(), timeout, this.client.version(), restype, comp, context); + return service.getStatistics(this.client.url(), shareName, timeout, this.client.version(), restype, comp, context); } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/models/DeleteSnapshotsOptionType.java b/storage/client/file/src/main/java/com/azure/storage/file/models/DeleteSnapshotsOptionType.java index 080e8961a2710..002eb887ac448 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/models/DeleteSnapshotsOptionType.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/models/DeleteSnapshotsOptionType.java @@ -14,12 +14,7 @@ public enum DeleteSnapshotsOptionType { /** * Enum value include. */ - INCLUDE("include"), - - /** - * Enum value only. - */ - ONLY("only"); + INCLUDE("include"); /** * The actual serialized value for a DeleteSnapshotsOptionType instance. diff --git a/storage/client/file/src/main/java/com/azure/storage/file/models/DirectoryInfo.java b/storage/client/file/src/main/java/com/azure/storage/file/models/DirectoryInfo.java index bd529f2538e2f..4248582e22d9b 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/models/DirectoryInfo.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/models/DirectoryInfo.java @@ -3,5 +3,37 @@ package com.azure.storage.file.models; +import java.time.OffsetDateTime; + +/** + * Contains information about a Directory in the storage File service. + */ public final class DirectoryInfo { + private String eTag; + private OffsetDateTime lastModified; + + /** + * Creates an instance of information about a specific Directory. + * + * @param eTag Entity tag that corresponds to the directory. + * @param lastModified Last time the directory was modified. + */ + public DirectoryInfo(final String eTag, final OffsetDateTime lastModified) { + this.eTag = eTag; + this.lastModified = lastModified; + } + + /** + * @return The entity tag that corresponds to the directory. + */ + public String eTag() { + return eTag; + } + + /** + * @return The last time the share was modified. + */ + public OffsetDateTime lastModified() { + return lastModified; + } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/models/DirectoryProperties.java b/storage/client/file/src/main/java/com/azure/storage/file/models/DirectoryProperties.java index b140fd4a481eb..f39e8d8ac0162 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/models/DirectoryProperties.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/models/DirectoryProperties.java @@ -3,5 +3,58 @@ package com.azure.storage.file.models; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * Contains properties information about a Directory in the storage File service. + */ public final class DirectoryProperties { + private Map metadata; + private String eTag; + private OffsetDateTime lastModified; + private boolean isServerEncrypted; + + /** + * Creates an instance of properties information about a specific Directory. + * + * @param metadata A set of name-value pairs that contain metadata for the directory. + * @param eTag Entity tag that corresponds to the directory. + * @param lastModified Last time the directory was modified. + * @param isServerEncrypted The value of this header is set to true if the directory metadata is completely encrypted using the specified algorithm. Otherwise, the value is set to false. + */ + public DirectoryProperties(final Map metadata, final String eTag, final OffsetDateTime lastModified, final boolean isServerEncrypted) { + this.metadata = metadata; + this.eTag = eTag; + this.lastModified = lastModified; + this.isServerEncrypted = isServerEncrypted; + } + + /** + * @return A set of name-value pairs that contain metadata for the directory. + */ + public Map metadata() { + return metadata; + } + + /** + * @return Entity tag that corresponds to the directory. + */ + public String eTag() { + return eTag; + } + + /** + * @return Entity tag that corresponds to the directory. + */ + public OffsetDateTime lastModified() { + return lastModified; + } + + /** + * @return The value of this header is true if the directory metadata is completely encrypted using the specified algorithm. Otherwise, the value is false. + */ + public boolean isServerEncrypted() { + return isServerEncrypted; + } } diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectorySetMetadataInfo.java b/storage/client/file/src/main/java/com/azure/storage/file/models/DirectorySetMetadataInfo.java similarity index 100% rename from storage/client/src/main/java/com/azure/storage/file/models/DirectorySetMetadataInfo.java rename to storage/client/file/src/main/java/com/azure/storage/file/models/DirectorySetMetadataInfo.java diff --git a/storage/client/file/src/main/java/com/azure/storage/file/models/FileCopyInfo.java b/storage/client/file/src/main/java/com/azure/storage/file/models/FileCopyInfo.java index fe4498b81c3da..cf1e02a688923 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/models/FileCopyInfo.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/models/FileCopyInfo.java @@ -3,5 +3,61 @@ package com.azure.storage.file.models; +import java.time.OffsetDateTime; + +/** + * Contains copy information about a File in the storage File service. + */ public final class FileCopyInfo { + private String eTag; + private OffsetDateTime lastModified; + private String copyId; + private CopyStatusType copyStatus; + + /** + * Creates an instance of copy information about a specific File. + * + * @param eTag Entity tag that corresponds to the directory. + * @param lastModified Last time the directory was modified. + * @param copyId String identifier for this copy operation. + * @param copyStatus State of the copy operation with these values: + * - success: the copy completed successfully. + * - pending: the copy is still in progress. + */ + public FileCopyInfo(final String eTag, final OffsetDateTime lastModified, final String copyId, final CopyStatusType copyStatus) { + this.eTag = eTag; + this.lastModified = lastModified; + this.copyId = copyId; + this.copyStatus = copyStatus; + } + + /** + * @return Entity tag that corresponds to the directory. + */ + public String eTag() { + return eTag; + } + + /** + * @return Last time the directory was modified. + */ + public OffsetDateTime lastModified() { + return lastModified; + } + + /** + * @return String identifier for this copy operation. + */ + public String copyId() { + return copyId; + } + + /** + * @return State of the copy operation with these values: + * - success: the copy completed successfully. + * - pending: the copy is still in progress. + */ + public CopyStatusType copyStatus() { + return copyStatus; + } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/models/FileDownloadInfo.java b/storage/client/file/src/main/java/com/azure/storage/file/models/FileDownloadInfo.java index 694fe762c8131..a1e4dbe9c3167 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/models/FileDownloadInfo.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/models/FileDownloadInfo.java @@ -3,5 +3,90 @@ package com.azure.storage.file.models; +import io.netty.buffer.ByteBuf; +import java.time.OffsetDateTime; +import java.util.Map; +import reactor.core.publisher.Flux; + +/** + * Contains download information about a File in the storage File service. + */ public final class FileDownloadInfo { + private String eTag; + private OffsetDateTime lastModified; + private Map metadata; + private Long contentLength; + private String contentType; + private String contentRange; + private Flux body; + + /** + * Creates an instance of download information about a specific File. + * + * @param eTag Entity tag that corresponds to the directory. + * @param lastModified Last time the directory was modified. + * @param metadata A set of name-value pairs associated with this file as user-defined metadata. + * @param contentLength The number of bytes present in the response body. + * @param contentType The content type specified for the file. The default content type is application/octet-stream. + * @param contentRange Indicates the range of bytes returned if the client requested a subset of the file by setting the Range request header. + * @param body The download request body. + */ + public FileDownloadInfo(final String eTag, final OffsetDateTime lastModified, final Map metadata, final Long contentLength, final String contentType, final String contentRange, final Flux body) { + this.eTag = eTag; + this.lastModified = lastModified; + this.metadata = metadata; + this.contentLength = contentLength; + this.contentType = contentType; + this.contentRange = contentRange; + this.body = body; + } + + /** + * @return Entity tag that corresponds to the directory. + */ + public String eTag() { + return eTag; + } + + /** + * @return Last time the directory was modified. + */ + public OffsetDateTime lastModified() { + return lastModified; + } + + /** + * @return A set of name-value pairs associated with this file as user-defined metadata. + */ + public Map metadata() { + return metadata; + } + + /** + * @return The number of bytes present in the response body. + */ + public Long contentLength() { + return contentLength; + } + + /** + * @return The content type specified for the file. The default content type is application/octet-stream. + */ + public String contentType() { + return contentType; + } + + /** + * @return The range of bytes returned if the client requested a subset of the file by setting the Range request header. + */ + public String contentRange() { + return contentRange; + } + + /** + * @return The download request body. + */ + public Flux body() { + return body; + } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/models/FileInfo.java b/storage/client/file/src/main/java/com/azure/storage/file/models/FileInfo.java index 47a634785e190..371b5f9fdcbd2 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/models/FileInfo.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/models/FileInfo.java @@ -3,5 +3,47 @@ package com.azure.storage.file.models; +import java.time.OffsetDateTime; + +/** + * Contains information about a File in the storage File service. + */ public final class FileInfo { + private String eTag; + private OffsetDateTime lastModified; + private Boolean isServerEncrypted; + + /** + * Creates an instance of information about a specific Directory. + * + * @param eTag Entity tag that corresponds to the directory. + * @param lastModified Last time the directory was modified. + * @param isServerEncrypted The value of this header is set to true if the directory metadata is completely encrypted using the specified algorithm. Otherwise, the value is set to false. + */ + public FileInfo(final String eTag, final OffsetDateTime lastModified, final Boolean isServerEncrypted) { + this.eTag = eTag; + this.lastModified = lastModified; + this.isServerEncrypted = isServerEncrypted; + } + + /** + * @return The entity tag that corresponds to the directory. + */ + public String eTag() { + return eTag; + } + + /** + * @return The last time the share was modified. + */ + public OffsetDateTime lastModified() { + return lastModified; + } + + /** + * @return The value of this header is true if the directory metadata is completely encrypted using the specified algorithm. Otherwise, the value is false. + */ + public Boolean isServerEncrypted() { + return isServerEncrypted; + } } diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileMetadataInfo.java b/storage/client/file/src/main/java/com/azure/storage/file/models/FileMetadataInfo.java similarity index 100% rename from storage/client/src/main/java/com/azure/storage/file/models/FileMetadataInfo.java rename to storage/client/file/src/main/java/com/azure/storage/file/models/FileMetadataInfo.java diff --git a/storage/client/file/src/main/java/com/azure/storage/file/models/FileProperties.java b/storage/client/file/src/main/java/com/azure/storage/file/models/FileProperties.java index dd691c0b06871..f49180dfa0da9 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/models/FileProperties.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/models/FileProperties.java @@ -3,5 +3,200 @@ package com.azure.storage.file.models; +import com.azure.core.implementation.util.ImplUtils; +import java.time.OffsetDateTime; +import java.util.Map; + +/** + * Contains property information about a File in the storage File service. + */ public final class FileProperties { + private String eTag; + private OffsetDateTime lastModified; + private Map metadata; + private String fileType; + private Long contentLength; + private String contentType; + private byte[] contentMD5; + private String contentEncoding; + private String cacheControl; + private String contentDisposition; + private OffsetDateTime copyCompletionTime; + private String copyStatusDescription; + private String copyId; + private String copyProgress; + private String copySource; + private CopyStatusType copyStatus; + private Boolean isServerEncrypted; + + /** + * Creates an instance of property information about a specific File. + * + * @param eTag Entity tag that corresponds to the directory. + * @param lastModified Last time the directory was modified. + * @param metadata A set of name-value pairs associated with this file as user-defined metadata. + * @param fileType Type of the file. + * @param contentLength The number of bytes present in the response body. + * @param contentType The content type specified for the file. The default content type is application/octet-stream. + * @param contentMD5 The MD5 hash of the file to check the message content integrity. + * @param contentEncoding This header returns the value that was specified for the Content-Encoding request header. + * @param cacheControl This header is returned if it was previously specified for the file. + * @param contentDisposition The value that was specified for the x-ms-content-disposition header and specifies how to process the response. + * @param copyCompletionTime Conclusion time of the last attempted Copy File operation where this file was the destination file. + * @param copyStatusDescription Appears when x-ms-copy-status is failed or pending. Describes cause of fatal or non-fatal copy operation failure. + * @param copyId String identifier for the last attempted Copy File operation where this file was the destination file. + * @param copyProgress Contains the number of bytes copied and the total bytes in the source in the last attempted Copy File operation where this file was the destination file. + * @param copySource URL up to 2KB in length that specifies the source file used in the last attempted Copy File operation where this file was the destination file. + * @param copyStatus State of the copy operation identified by x-ms-copy-id, with these values: + * - success: Copy completed successfully. + * - pending: Copy is in progress. Check x-ms-copy-status-description if intermittent, non-fatal errors impede copy progress but don't cause failure. + * - aborted: Copy was ended by Abort Copy File. + * - failed: Copy failed. See x-ms-copy-status-description for failure details. + * @param isServerEncrypted The value of this header is set to true if the file data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false. + */ + public FileProperties(final String eTag, final OffsetDateTime lastModified, final Map metadata, + final String fileType, final Long contentLength, final String contentType, final byte[] contentMD5, + final String contentEncoding, final String cacheControl, final String contentDisposition, + final OffsetDateTime copyCompletionTime, final String copyStatusDescription, final String copyId, + final String copyProgress, final String copySource, final CopyStatusType copyStatus, final Boolean isServerEncrypted) { + this.eTag = eTag; + this.lastModified = lastModified; + this.metadata = metadata; + this.fileType = fileType; + this.contentLength = contentLength; + this.contentType = contentType; + this.contentMD5 = contentMD5; + this.contentEncoding = contentEncoding; + this.cacheControl = cacheControl; + this.contentDisposition = contentDisposition; + this.copyCompletionTime = copyCompletionTime; + this.copyStatusDescription = copyStatusDescription; + this.copyId = copyId; + this.copyProgress = copyProgress; + this.copySource = copySource; + this.copyStatus = copyStatus; + this.isServerEncrypted = isServerEncrypted; + } + + /** + * @return Entity tag that corresponds to the directory. + */ + public String eTag() { + return eTag; + } + + /** + * @return Last time the directory was modified. + */ + public OffsetDateTime lastModified() { + return lastModified; + } + + /** + * @return A set of name-value pairs associated with this file as user-defined metadata. + */ + public Map metadata() { + return metadata; + } + + /** + * @return The number of bytes present in the response body. + */ + public Long contentLength() { + return contentLength; + } + + /** + * @return The type of the file. + */ + public String fileType() { + return fileType; + } + /** + * @return The content type specified for the file. The default content type is application/octet-stream. + */ + public String contentType() { + return contentType; + } + + /** + * @return The MD5 hash of the file. + */ + public byte[] contentMD5() { + return ImplUtils.clone(contentMD5); + } + + /** + * @return The value that was specified for the Content-Encoding request header. + */ + public String contentEncoding() { + return contentEncoding; + } + + /** + * @return This header is returned if it was previously specified for the file. + */ + public String cacheControl() { + return cacheControl; + } + + /** + * @return The value that was specified for the x-ms-content-disposition header and specifies how to process the response. + */ + public String contentDisposition() { + return contentDisposition; + } + + /** + * @return Conclusion time of the last attempted Copy File operation where this file was the destination file. + */ + public OffsetDateTime copyCompletionTime() { + return copyCompletionTime; + } + + /** + * @return When x-ms-copy-status is failed or pending. Describes cause of fatal or non-fatal copy operation failure. + */ + public String copyStatusDescription() { + return copyStatusDescription; + } + + /** + * @return String identifier for the last attempted Copy File operation where this file was the destination file. + */ + public String copyId() { + return copyId; + } + + /** + * @return The number of bytes copied and the total bytes in the source in the last attempted Copy File operation where this file was the destination file. + */ + public String copyProgress() { + return copyProgress; + } + + /** + * @return URL up to 2KB in length that specifies the source file used in the last attempted Copy File operation where this file was the destination file. + */ + public String copySource() { + return copySource; + } + + /** + * @return State of the copy operation identified by x-ms-copy-id, with these values: + * - success: Copy completed successfully. + * - pending: Copy is in progress. Check x-ms-copy-status-description if intermittent, non-fatal errors impede copy progress but don't cause failure. + * - aborted: Copy was ended by Abort Copy File. + * - failed: Copy failed. See x-ms-copy-status-description for failure details. + */ + public CopyStatusType copyStatus() { + return copyStatus; + } + + /** + * @return True if the file data and application metadata are completely encrypted using the specified algorithm. Otherwise, return false. + */ + public Boolean isServerEncrypted() { + return isServerEncrypted; + } } diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileRange.java b/storage/client/file/src/main/java/com/azure/storage/file/models/FileRange.java similarity index 100% rename from storage/client/src/main/java/com/azure/storage/file/models/FileRange.java rename to storage/client/file/src/main/java/com/azure/storage/file/models/FileRange.java diff --git a/storage/client/file/src/main/java/com/azure/storage/file/models/FileRef.java b/storage/client/file/src/main/java/com/azure/storage/file/models/FileRef.java index 0cd1261d2af97..1db76cbdffea0 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/models/FileRef.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/models/FileRef.java @@ -3,5 +3,47 @@ package com.azure.storage.file.models; +/** + * Contains file or directory reference information in the storage File service. + */ public final class FileRef { + private String name; + private boolean isDirectory; + private FileProperty fileProperty; + + /** + * Creates an instance of file or directory reference information about a specific Share. + * + * @param name Name of the file or the directory. + * @param isDirectory A boolean set to true if the reference is a directory, false if the reference is a file. + * @param fileProperty Property of a file. Pass {@code null} if the reference is a directory. + */ + public FileRef(final String name, final boolean isDirectory, final FileProperty fileProperty) { + this.name = name; + this.isDirectory = isDirectory; + this.fileProperty = fileProperty; + } + + + /** + * @return Name of the file or the directory. + */ + public String name() { + return name; + } + + /** + * @return True if the reference is a directory, or false if the reference is a file. + */ + public boolean isDirectory() { + return isDirectory; + } + + /** + * @return Property of a file. Return {@code null} if the reference is a directory. + */ + public FileProperty fileProperties() { + return fileProperty; + } + } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/models/FileServiceProperties.java b/storage/client/file/src/main/java/com/azure/storage/file/models/FileServiceProperties.java index 8ad66286adba1..ef42bbb4becf8 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/models/FileServiceProperties.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/models/FileServiceProperties.java @@ -1,7 +1,115 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.storage.file.models; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; +import java.util.ArrayList; +import java.util.List; + +/** + * Storage service properties. + */ +@JacksonXmlRootElement(localName = "StorageServiceProperties") public final class FileServiceProperties { + /* + * A summary of request statistics grouped by API in hourly aggregates for + * files. + */ + @JsonProperty(value = "HourMetrics") + private Metrics hourMetrics; + + /* + * A summary of request statistics grouped by API in minute aggregates for + * files. + */ + @JsonProperty(value = "MinuteMetrics") + private Metrics minuteMetrics; + + private static final class CorsWrapper { + @JacksonXmlProperty(localName = "CorsRule") + private final List items; + + @JsonCreator + private CorsWrapper(@JacksonXmlProperty(localName = "CorsRule") List items) { + this.items = items; + } + } + + /* + * The set of CORS rules. + */ + @JsonProperty(value = "Cors") + private CorsWrapper cors; + + /** + * Get the hourMetrics property: A summary of request statistics grouped by + * API in hourly aggregates for files. + * + * @return the hourMetrics value. + */ + public Metrics hourMetrics() { + return this.hourMetrics; + } + + /** + * Set the hourMetrics property: A summary of request statistics grouped by + * API in hourly aggregates for files. + * + * @param hourMetrics the hourMetrics value to set. + * @return the FileServiceProperties object itself. + */ + public FileServiceProperties hourMetrics(Metrics hourMetrics) { + this.hourMetrics = hourMetrics; + return this; + } + + /** + * Get the minuteMetrics property: A summary of request statistics grouped + * by API in minute aggregates for files. + * + * @return the minuteMetrics value. + */ + public Metrics minuteMetrics() { + return this.minuteMetrics; + } + + /** + * Set the minuteMetrics property: A summary of request statistics grouped + * by API in minute aggregates for files. + * + * @param minuteMetrics the minuteMetrics value to set. + * @return the FileServiceProperties object itself. + */ + public FileServiceProperties minuteMetrics(Metrics minuteMetrics) { + this.minuteMetrics = minuteMetrics; + return this; + } + + /** + * Get the cors property: The set of CORS rules. + * + * @return the cors value. + */ + public List cors() { + if (this.cors == null) { + this.cors = new CorsWrapper(new ArrayList()); + } + return this.cors.items; + } + + /** + * Set the cors property: The set of CORS rules. + * + * @param cors the cors value to set. + * @return the FileServiceProperties object itself. + */ + public FileServiceProperties cors(List cors) { + this.cors = new CorsWrapper(cors); + return this; + } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/models/FileUploadInfo.java b/storage/client/file/src/main/java/com/azure/storage/file/models/FileUploadInfo.java index 644075f434f74..6d48aac73be1e 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/models/FileUploadInfo.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/models/FileUploadInfo.java @@ -3,5 +3,35 @@ package com.azure.storage.file.models; +import com.azure.core.implementation.util.ImplUtils; +import java.time.OffsetDateTime; + public final class FileUploadInfo { + private String eTag; + private OffsetDateTime lastModified; + private byte[] contentMD5; + private Boolean isServerEncrypted; + + public FileUploadInfo(final String eTag, final OffsetDateTime lastModified, final byte[] contentMD5, final Boolean isServerEncrypted) { + this.eTag = eTag; + this.lastModified = lastModified; + this.contentMD5 = contentMD5; + this.isServerEncrypted = isServerEncrypted; + } + + public String eTag() { + return eTag; + } + + public OffsetDateTime lastModified() { + return lastModified; + } + + public byte[] contentMD5() { + return contentMD5; + } + + public Boolean isServerEncrypted() { + return isServerEncrypted; + } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/models/ListSharesOptions.java b/storage/client/file/src/main/java/com/azure/storage/file/models/ListSharesOptions.java index 612b95238ea2a..a75b4bab697f1 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/models/ListSharesOptions.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/models/ListSharesOptions.java @@ -3,5 +3,107 @@ package com.azure.storage.file.models; +/** + * A set of options for selecting shares from Storage File service. + * + *
    + *
  • + * Providing {@link ListSharesOptions#prefix(String) prefix} will filter selections to {@link ShareItem shares} + * that that begin with the prefix. + *
  • + *
  • + * Providing {@link ListSharesOptions#maxResults(Integer) maxResults} will limit the number of {@link ShareItem shares} + * returned in a single page. + *
  • + *
  • + * Setting {@link ListSharesOptions#includeMetadata(boolean) includeMetadata} to true will include the metadata + * of each {@link ShareItem share}, if false {@link ShareItem#metadata() metadata} for each share will be {@code null}. + *
  • + *
  • + * Setting {@link ListSharesOptions#includeSnapshots(boolean) includeSnapshots} to true will include snapshots + * of each {@link ShareItem share}, the snapshot will be included as separate items in the response and will be + * identifiable by {@link ShareItem#snapshot() snapshot} having a value. The base share will contain {@code null} + * for the snapshot. + *
  • + *
+ */ public final class ListSharesOptions { + private String prefix; + private Integer maxResults; + private boolean includeMetadata; + private boolean includeSnapshots; + + /** + * Sets the prefix that a share must match to be included in the listing. + * + * @param prefix The prefix that shares must start with to pass the filter + * @return An updated ListSharesOptions object + */ + public ListSharesOptions prefix(String prefix) { + this.prefix = prefix; + return this; + } + + /** + * @return the prefix that a share must match to be included in the listing + */ + public String prefix() { + return prefix; + } + + /** + * Sets the maximum number of shares to include in a single response. + * + * @param maxResults Maximum number of shares to include in a single response. This value must be between 1 and 5000. + * @return An updated ListSharesOptions object + */ + public ListSharesOptions maxResults(Integer maxResults) { + this.maxResults = maxResults; + return this; + } + + /** + * @return the maximum number of shares to inlcude in a single response + */ + public Integer maxResults() { + return maxResults; + } + + /** + * Sets the status of including share metadata when listing shares + * + * If listing snapshots as well this will also determine if the snapshots have their metadata included as well. + * + * @param includeMetadata Flag indicating if metadata should be including in the listing + * @return An updated ListSharesOptions object + */ + public ListSharesOptions includeMetadata(boolean includeMetadata) { + this.includeMetadata = includeMetadata; + return this; + } + + /** + * @return the status of include share metadata when listing shares + */ + public boolean includeMetadata() { + return includeMetadata; + } + + /** + * Sets the status of including share snapshots when listing shares + * + * @param includeSnapshots Flag indicating if snapshots should be included in the listing + * @return An updated ListSharesOptions object + */ + public ListSharesOptions includeSnapshots(boolean includeSnapshots) { + this.includeSnapshots = includeSnapshots; + return this; + } + + /** + * @return the status of including share snapshots when listing shares + */ + public boolean includeSnapshots() { + return includeSnapshots; + } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/models/ServicesGetPropertiesResponse.java b/storage/client/file/src/main/java/com/azure/storage/file/models/ServicesGetPropertiesResponse.java index 267a198ab8b8d..92a15ab7d889e 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/models/ServicesGetPropertiesResponse.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/models/ServicesGetPropertiesResponse.java @@ -11,7 +11,7 @@ /** * Contains all response data for the getProperties operation. */ -public final class ServicesGetPropertiesResponse extends ResponseBase { +public final class ServicesGetPropertiesResponse extends ResponseBase { /** * Creates an instance of ServicesGetPropertiesResponse. * @@ -21,7 +21,7 @@ public final class ServicesGetPropertiesResponse extends ResponseBase metadata; + /** * Get the lastModified property: The lastModified property. * @@ -98,4 +104,13 @@ public ShareProperties quota(int quota) { this.quota = quota; return this; } + + public Map metadata() { + return metadata; + } + + public ShareProperties metadata(Map metadata) { + this.metadata = metadata; + return this; + } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/models/ShareSnapshotInfo.java b/storage/client/file/src/main/java/com/azure/storage/file/models/ShareSnapshotInfo.java index 2a3e17d8ad01d..4e95b45182a23 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/models/ShareSnapshotInfo.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/models/ShareSnapshotInfo.java @@ -3,5 +3,49 @@ package com.azure.storage.file.models; -public final class ShareSnapshotInfo { +import java.time.OffsetDateTime; + +/** + * Contains information about a snapshot of a Share in the storage File service. + */ +public final class ShareSnapshotInfo { + private String snapshot; + private String eTag; + private OffsetDateTime lastModified; + + /** + * Creates an instance of snapshot information for a specific Share. + * + * @param snapshot Identifier for the snapshot + * @param eTag Entity tag that corresponds to the snapshot + * @param lastModified Last time the Share was modified if the snapshot was created without metadata, if the snapshot + * was created with metadata then it will be the time the snapshot was created + */ + public ShareSnapshotInfo(String snapshot, String eTag, OffsetDateTime lastModified) { + this.snapshot = snapshot; + this.eTag = eTag; + this.lastModified = lastModified; + } + + /** + * @return the identifier of the snapshot + */ + public String snapshot() { + return snapshot; + } + + /** + * @return the entity tag that corresponds to the snapshot + */ + public String eTag() { + return eTag; + } + + /** + * @return the last time the share was modified if the snapshot was created without metadata, otherwise this is the + * time that the snapshot was created. + */ + public OffsetDateTime lastModified() { + return lastModified; + } } diff --git a/storage/client/file/src/main/java/com/azure/storage/file/models/ShareStatistics.java b/storage/client/file/src/main/java/com/azure/storage/file/models/ShareStatistics.java index aef819551c53f..d10648dfb3dc8 100644 --- a/storage/client/file/src/main/java/com/azure/storage/file/models/ShareStatistics.java +++ b/storage/client/file/src/main/java/com/azure/storage/file/models/ShareStatistics.java @@ -3,5 +3,25 @@ package com.azure.storage.file.models; +/** + * Contains statistics about a Share in the storage File service. + */ public final class ShareStatistics { + private final int shareUsageInGB; + + /** + * Creates an instance of storage statistics for a Share. + * + * @param shareUsageInGB Size in GB of the Share + */ + public ShareStatistics(int shareUsageInGB) { + this.shareUsageInGB = shareUsageInGB; + } + + /** + * @return the size in GB of the Share + */ + public int getShareUsageInGB() { + return shareUsageInGB; + } } diff --git a/storage/client/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java b/storage/client/file/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java similarity index 92% rename from storage/client/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java rename to storage/client/file/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java index a80655f1c9969..e978d17eb7c70 100644 --- a/storage/client/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java +++ b/storage/client/file/src/samples/java/com/azure/storage/file/DirectoryJavaDocCodeSamples.java @@ -6,9 +6,6 @@ import com.azure.core.http.rest.VoidResponse; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.file.DirectoryAsyncClient; -import com.azure.storage.file.DirectoryClient; -import com.azure.storage.file.FileClient; import com.azure.storage.file.models.DirectoryInfo; /** @@ -22,11 +19,11 @@ public class DirectoryJavaDocCodeSamples { */ public DirectoryClient createClientWithSASToken() { // BEGIN: com.azure.storage.file.directoryClient.instantiation.sastoken - DirectoryClient directoryClient = DirectoryClient.builder() + DirectoryClient directoryClient = new DirectoryClientBuilder() .endpoint("https://${accountName}.file.core.windows.net?${SASToken}") .shareName("myshare") .directoryName("mydirectory") - .build(); + .buildClient(); // END: com.azure.storage.file.directoryClient.instantiation.sastoken return directoryClient; } @@ -37,11 +34,11 @@ public DirectoryClient createClientWithSASToken() { */ public DirectoryAsyncClient createAsyncClientWithSASToken() { // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation.sastoken - DirectoryAsyncClient directoryAsyncClient = DirectoryAsyncClient.builder() + DirectoryAsyncClient directoryAsyncClient = new DirectoryClientBuilder() .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") .shareName("myshare") .directoryName("mydirectory") - .buildAsync(); + .buildAsyncClient(); // END: com.azure.storage.file.directoryAsyncClient.instantiation.sastoken return directoryAsyncClient; } @@ -52,10 +49,11 @@ public DirectoryAsyncClient createAsyncClientWithSASToken() { */ public DirectoryClient createClientWithConnectionString() { // BEGIN: com.azure.storage.file.directoryClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};EndpointSuffix={core.windows.net}"; - DirectoryClient directoryClient = DirectoryClient.builder() + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key}" + + ";EndpointSuffix={core.windows.net}"; + DirectoryClient directoryClient = new DirectoryClientBuilder() .connectionString(connectionString).shareName("myshare").directoryName("mydirectory") - .build(); + .buildClient(); // END: com.azure.storage.file.directoryClient.instantiation.connectionstring return directoryClient; } @@ -66,10 +64,11 @@ public DirectoryClient createClientWithConnectionString() { */ public DirectoryAsyncClient createAsyncClientWithConnectionString() { // BEGIN: com.azure.storage.file.directoryAsyncClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};EndpointSuffix={core.windows.net}"; - DirectoryAsyncClient directoryAsyncClient = DirectoryAsyncClient.builder() + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" + + "EndpointSuffix={core.windows.net}"; + DirectoryAsyncClient directoryAsyncClient = new DirectoryClientBuilder() .connectionString(connectionString).shareName("myshare").directoryName("mydirectory") - .buildAsync(); + .buildAsyncClient(); // END: com.azure.storage.file.directoryAsyncClient.instantiation.connectionstring return directoryAsyncClient; } @@ -117,7 +116,8 @@ public void createSubDirectoryAsync() { DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.createSubDirectory#string directoryAsyncClient.createSubDirectory("mysubdirectory").subscribe( - response -> System.out.println("Successfully creating the subdirectory with status code: " + response.statusCode()), + response -> System.out.println("Successfully creating the subdirectory with status code: " + + response.statusCode()), error -> System.err.println(error.toString()), () -> System.out.println("Complete creating the sub directory.") ); @@ -156,7 +156,8 @@ public void listDirectoriesAndFiles() { DirectoryClient directoryClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryClient.listFilesAndDirectories directoryClient.listFilesAndDirectories().forEach( - fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.", fileRef.isDirectory(),fileRef.name()) + fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.", + fileRef.isDirectory(),fileRef.name()) ); // END: com.azure.storage.file.directoryClient.listFilesAndDirectories } @@ -169,7 +170,8 @@ public void listDirectoriesAndFilesAsync() { DirectoryAsyncClient directoryAsyncClient = createAsyncClientWithSASToken(); // BEGIN: com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories directoryAsyncClient.listFilesAndDirectories().subscribe( - fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.", fileRef.isDirectory(),fileRef.name()), + fileRef -> System.out.printf("Is the resource a directory? %b. The resource name is: %s.", + fileRef.isDirectory(),fileRef.name()), error -> System.err.println(error.toString()), () -> System.out.println("Complete listing the directories and files.") ); diff --git a/storage/client/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java b/storage/client/file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java similarity index 92% rename from storage/client/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java rename to storage/client/file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java index ac2860c5b0f8e..6eb33071e1c49 100644 --- a/storage/client/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java +++ b/storage/client/file/src/samples/java/com/azure/storage/file/FileJavaDocCodeSamples.java @@ -6,8 +6,6 @@ import com.azure.core.http.rest.VoidResponse; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.file.FileAsyncClient; -import com.azure.storage.file.FileClient; import com.azure.storage.file.models.FileCopyInfo; import com.azure.storage.file.models.FileDownloadInfo; import com.azure.storage.file.models.FileInfo; @@ -32,11 +30,11 @@ public class FileJavaDocCodeSamples { public FileClient createClientWithSASToken() { // BEGIN: com.azure.storage.file.fileClient.instantiation.sastoken - FileClient fileClient = FileClient.builder() + FileClient fileClient = new FileClientBuilder() .endpoint("https://${accountName}.file.core.windows.net?${SASToken}") .shareName("myshare") .filePath("myfilepath") - .build(); + .buildClient(); // END: com.azure.storage.file.fileClient.instantiation.sastoken return fileClient; } @@ -47,11 +45,11 @@ public FileClient createClientWithSASToken() { */ public FileAsyncClient createAsyncClientWithSASToken() { // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation.sastoken - FileAsyncClient fileAsyncClient = FileAsyncClient.builder() + FileAsyncClient fileAsyncClient = new FileClientBuilder() .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") .shareName("myshare") .filePath("myfilepath") - .buildAsync(); + .buildAsyncClient(); // END: com.azure.storage.file.fileAsyncClient.instantiation.sastoken return fileAsyncClient; } @@ -62,10 +60,11 @@ public FileAsyncClient createAsyncClientWithSASToken() { */ public FileClient createClientWithConnectionString() { // BEGIN: com.azure.storage.file.fileClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};EndpointSuffix={core.windows.net}"; - FileClient fileClient = FileClient.builder() + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" + + "EndpointSuffix={core.windows.net}"; + FileClient fileClient = new FileClientBuilder() .connectionString(connectionString).shareName("myshare").filePath("myfilepath") - .build(); + .buildClient(); // END: com.azure.storage.file.fileClient.instantiation.connectionstring return fileClient; } @@ -76,10 +75,11 @@ public FileClient createClientWithConnectionString() { */ public FileAsyncClient createAsyncClientWithConnectionString() { // BEGIN: com.azure.storage.file.fileAsyncClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};EndpointSuffix={core.windows.net}"; - FileAsyncClient fileAsyncClient = FileAsyncClient.builder() + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" + + "EndpointSuffix={core.windows.net}"; + FileAsyncClient fileAsyncClient = new FileClientBuilder() .connectionString(connectionString).shareName("myshare").filePath("myfilepath") - .buildAsync(); + .buildAsyncClient(); // END: com.azure.storage.file.fileAsyncClient.instantiation.connectionstring return fileAsyncClient; } @@ -115,7 +115,9 @@ public void createFileAsync() { public void copyFile() { FileClient fileClient = createClientWithSASToken(); // BEGIN: com.azure.storage.file.fileClient.startCopy#string-map - Response response = fileClient.startCopy("https://{accountName}.file.core.windows.net?{SASToken}", Collections.singletonMap("file", "metadata")); + Response response = fileClient.startCopy( + "https://{accountName}.file.core.windows.net?{SASToken}", + Collections.singletonMap("file", "metadata")); System.out.println("Complete copying the file with status code: " + response.statusCode()); // END: com.azure.storage.file.fileClient.startCopy#string-map } @@ -126,7 +128,8 @@ public void copyFile() { public void copyFileAsync() { FileAsyncClient fileAsyncClient = createAsyncClientWithSASToken(); // BEGIN: com.azure.storage.file.fileAsyncClient.startCopy#string-map - fileAsyncClient.startCopy("https://{accountName}.file.core.windows.net?{SASToken}", Collections.singletonMap("file", "metadata")).subscribe( + fileAsyncClient.startCopy("https://{accountName}.file.core.windows.net?{SASToken}", + Collections.singletonMap("file", "metadata")).subscribe( response -> System.out.println("Successfully copying the file with status code: " + response.statusCode()), error -> System.err.println(error.toString()), () -> System.out.println("Complete copying the file.") @@ -194,7 +197,8 @@ public void downloadData() { Response response = fileClient.downloadWithProperties(); System.out.println("Complete downloading the data with status code: " + response.statusCode()); response.value().body().subscribe( - byteBuf -> System.out.println("Complete downloading the data with body: " + byteBuf.toString(StandardCharsets.UTF_8)), + byteBuf -> System.out.println("Complete downloading the data with body: " + + byteBuf.toString(StandardCharsets.UTF_8)), error -> System.err.print(error.toString()), () -> System.out.println("Complete downloading the data!") ); diff --git a/storage/client/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java b/storage/client/file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java similarity index 87% rename from storage/client/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java rename to storage/client/file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java index 0fb7f17625c2c..c48170224c7b7 100644 --- a/storage/client/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java +++ b/storage/client/file/src/samples/java/com/azure/storage/file/FileServiceJavaDocCodeSamples.java @@ -4,8 +4,6 @@ import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.file.FileServiceAsyncClient; -import com.azure.storage.file.FileServiceClient; /** * Contains code snippets when generating javadocs through doclets for {@link FileServiceClient} and {@link FileServiceAsyncClient}. @@ -18,9 +16,9 @@ public class FileServiceJavaDocCodeSamples { */ public FileServiceClient createClientWithSASToken() { // BEGIN: com.azure.storage.file.fileServiceClient.instantiation.sastoken - FileServiceClient fileServiceClient = FileServiceClient.builder() + FileServiceClient fileServiceClient = new FileServiceClientBuilder() .endpoint("https://${accountName}.file.core.windows.net?${SASToken}") - .build(); + .buildClient(); // END: com.azure.storage.file.fileServiceClient.instantiation.sastoken return fileServiceClient; } @@ -31,9 +29,9 @@ public FileServiceClient createClientWithSASToken() { */ public FileServiceAsyncClient createAsyncClientWithSASToken() { // BEGIN: com.azure.storage.file.fileServiceAsyncClient.instantiation.sastoken - FileServiceAsyncClient fileServiceAsyncClient = FileServiceAsyncClient.builder() + FileServiceAsyncClient fileServiceAsyncClient = new FileServiceClientBuilder() .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") - .buildAsync(); + .buildAsyncClient(); // END: com.azure.storage.file.fileServiceAsyncClient.instantiation.sastoken return fileServiceAsyncClient; } @@ -44,10 +42,11 @@ public FileServiceAsyncClient createAsyncClientWithSASToken() { */ public FileServiceClient createClientWithConnectionString() { // BEGIN: com.azure.storage.file.fileServiceClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};EndpointSuffix={core.windows.net}"; - FileServiceClient fileServiceClient = FileServiceClient.builder() + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" + + "EndpointSuffix={core.windows.net}"; + FileServiceClient fileServiceClient = new FileServiceClientBuilder() .connectionString(connectionString) - .build(); + .buildClient(); // END: com.azure.storage.file.fileServiceClient.instantiation.connectionstring return fileServiceClient; } @@ -58,10 +57,11 @@ public FileServiceClient createClientWithConnectionString() { */ public FileServiceAsyncClient createAsyncClientWithConnectionString() { // BEGIN: com.azure.storage.file.fileServiceAsyncClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};EndpointSuffix={core.windows.net}"; - FileServiceAsyncClient fileServiceAsyncClient = FileServiceAsyncClient.builder() + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" + + "EndpointSuffix={core.windows.net}"; + FileServiceAsyncClient fileServiceAsyncClient = new FileServiceClientBuilder() .connectionString(connectionString) - .buildAsync(); + .buildAsyncClient(); // END: com.azure.storage.file.fileServiceAsyncClient.instantiation.connectionstring return fileServiceAsyncClient; } @@ -133,10 +133,10 @@ public void deleteShare() { */ public void deleteShareAsync() { FileServiceAsyncClient fileServiceAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.fileServiceClient.deleteShare#string + // BEGIN: com.azure.storage.file.fileServiceAsyncClient.deleteShare#string fileServiceAsyncClient.deleteShare("myshare").subscribe( response -> System.out.println("Deleting the share completed with status code: " + response.statusCode()) ); - // END: com.azure.storage.file.fileServiceClient.deleteShare#string + // END: com.azure.storage.file.fileServiceAsyncClient.deleteShare#string } } diff --git a/storage/client/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java b/storage/client/file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java similarity index 77% rename from storage/client/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java rename to storage/client/file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java index d31f24a2c7638..9180fbebf5f93 100644 --- a/storage/client/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java +++ b/storage/client/file/src/samples/java/com/azure/storage/file/ShareJavaDocCodeSamples.java @@ -6,11 +6,10 @@ import com.azure.core.http.rest.VoidResponse; import com.azure.storage.common.credentials.SASTokenCredential; import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.file.DirectoryClient; -import com.azure.storage.file.ShareAsyncClient; -import com.azure.storage.file.ShareClient; import com.azure.storage.file.models.ShareInfo; import com.azure.storage.file.models.ShareSnapshotInfo; +import java.util.Collections; +import java.util.Map; /** * Contains code snippets when generating javadocs through doclets for {@link ShareClient} and {@link ShareAsyncClient}. @@ -24,11 +23,11 @@ public class ShareJavaDocCodeSamples { public ShareClient createClientWithSASToken() { // BEGIN: com.azure.storage.file.shareClient.instantiation.sastoken - ShareClient shareClient = ShareClient.builder() + ShareClient shareClient = new ShareClientBuilder() .endpoint("https://${accountName}.file.core.windows.net?${SASToken}") .shareName("myshare") - .build(); - // END: com.azure.storage.file.shareClient.instantiation.sastojen + .buildClient(); + // END: com.azure.storage.file.shareClient.instantiation.sastoken return shareClient; } @@ -38,11 +37,11 @@ public ShareClient createClientWithSASToken() { */ public ShareAsyncClient createAsyncClientWithSASToken() { // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation.sastoken - ShareAsyncClient shareAsyncClient = ShareAsyncClient.builder() + ShareAsyncClient shareAsyncClient = new ShareClientBuilder() .endpoint("https://{accountName}.file.core.windows.net?{SASToken}") .shareName("myshare") - .buildAsync(); - // END: com.azure.storage.file.share.AsyncClient.instantiation.sastoken + .buildAsyncClient(); + // END: com.azure.storage.file.shareAsyncClient.instantiation.sastoken return shareAsyncClient; } @@ -52,10 +51,11 @@ public ShareAsyncClient createAsyncClientWithSASToken() { */ public ShareClient createClientWithConnectionString() { // BEGIN: com.azure.storage.file.shareClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};EndpointSuffix={core.windows.net}"; - ShareClient shareClient = ShareClient.builder() + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" + + "EndpointSuffix={core.windows.net}"; + ShareClient shareClient = new ShareClientBuilder() .connectionString(connectionString).shareName("myshare") - .build(); + .buildClient(); // END: com.azure.storage.file.shareClient.instantiation.connectionstring return shareClient; } @@ -66,10 +66,11 @@ public ShareClient createClientWithConnectionString() { */ public ShareAsyncClient createAsyncClientWithConnectionString() { // BEGIN: com.azure.storage.file.shareAsyncClient.instantiation.connectionstring - String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};EndpointSuffix={core.windows.net}"; - ShareAsyncClient shareAsyncClient = ShareAsyncClient.builder() + String connectionString = "DefaultEndpointsProtocol=https;AccountName={name};AccountKey={key};" + + "EndpointSuffix={core.windows.net}"; + ShareAsyncClient shareAsyncClient = new ShareClientBuilder() .connectionString(connectionString).shareName("myshare") - .buildAsync(); + .buildAsyncClient(); // END: com.azure.storage.file.shareAsyncClient.instantiation.connectionstring return shareAsyncClient; } @@ -104,24 +105,24 @@ public void createShareAsync() { */ public void createDirectory() { ShareClient shareClient = createClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareClient.createDirectory + // BEGIN: com.azure.storage.file.shareClient.createDirectory#string Response response = shareClient.createDirectory("mydirectory"); System.out.println("Complete creating the directory with status code: " + response.statusCode()); - // END: com.azure.storage.file.shareClient.createDirectory + // END: com.azure.storage.file.shareClient.createDirectory#string } /** * Generates a code sample for using {@link ShareAsyncClient#createDirectory(String)} */ - public void createDirectoryeAsync() { + public void createDirectoryAsync() { ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); - // BEGIN: com.azure.storage.file.shareAsyncClient.createDirectory + // BEGIN: com.azure.storage.file.shareAsyncClient.createDirectory#string shareAsyncClient.createDirectory("mydirectory").subscribe( response -> {}, error -> System.err.print(error.toString()), () -> System.out.println("Complete creating the directory!") ); - // END: com.azure.storage.file.shareAsyncClient.createDirectory + // END: com.azure.storage.file.shareAsyncClient.createDirectory#string } /** @@ -142,13 +143,41 @@ public void createSnapshotAsync() { ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.createSnapshot shareAsyncClient.createSnapshot().subscribe( - response -> System.out.println("Successfully creating the share snapshot with snapshot id: " + response.value().snapshot()), + response -> System.out.println("Successfully creating the share snapshot with snapshot id: " + + response.value().snapshot()), error -> System.err.println(error.toString()), () -> System.out.println("Complete creating the share snapshot.") ); // END: com.azure.storage.file.shareAsyncClient.createSnapshot } + /** + * Generates a code sample for using {@link ShareClient#createSnapshot(Map)} + */ + public void createSnapshotWithMetadata() { + ShareClient shareClient = createClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareClient.createSnapshot#map + Response response = + shareClient.createSnapshot(Collections.singletonMap("snpashot", "metadata")); + System.out.println("Complete creating the share snpashot with snapshot id: " + response.value().snapshot()); + // END: com.azure.storage.file.shareClient.createSnapshot#map + } + + /** + * Generates a code sample for using {@link ShareAsyncClient#createSnapshot(Map)} + */ + public void createSnapshotAsyncWithMetadata() { + ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); + // BEGIN: com.azure.storage.file.shareAsyncClient.createSnapshot#map + shareAsyncClient.createSnapshot(Collections.singletonMap("snapshot", "metadata")).subscribe( + response -> System.out.println("Successfully creating the share snapshot with snapshot id: " + + response.value().snapshot()), + error -> System.err.println(error.toString()), + () -> System.out.println("Complete creating the share snapshot.") + ); + // END: com.azure.storage.file.shareAsyncClient.createSnapshot#map + } + /** * Generates a code sample for using {@link ShareClient#deleteDirectory(String)()} */ @@ -193,7 +222,8 @@ public void deleteShareAsync() { ShareAsyncClient shareAsyncClient = createAsyncClientWithSASToken(); // BEGIN: com.azure.storage.file.shareAsyncClient.delete shareAsyncClient.delete().subscribe( - response -> System.out.println("Deleting the shareAsyncClient completed with status code: " + response.statusCode()), + response -> System.out.println("Deleting the shareAsyncClient completed with status code: " + + response.statusCode()), error -> System.err.println(error.toString()), () -> System.out.println("Complete creating the share.") ); diff --git a/storage/client/src/samples/java/file/AsyncSample.java b/storage/client/file/src/samples/java/file/AsyncSample.java similarity index 93% rename from storage/client/src/samples/java/file/AsyncSample.java rename to storage/client/file/src/samples/java/file/AsyncSample.java index a90c1db4c5e38..df01912691fd8 100644 --- a/storage/client/src/samples/java/file/AsyncSample.java +++ b/storage/client/file/src/samples/java/file/AsyncSample.java @@ -4,6 +4,7 @@ import com.azure.core.util.configuration.ConfigurationManager; import com.azure.storage.file.FileServiceAsyncClient; +import com.azure.storage.file.FileServiceClientBuilder; import java.util.UUID; /** @@ -20,8 +21,8 @@ private static String generateRandomName() { public static void main(String[] args) { // Create a file service client - FileServiceAsyncClient fileServiceAsyncClient = FileServiceAsyncClient.builder().endpoint(ENDPOINT) - .buildAsync(); + FileServiceAsyncClient fileServiceAsyncClient = new FileServiceClientBuilder().endpoint(ENDPOINT) + .buildAsyncClient(); // Create a share String shareName = generateRandomName(); fileServiceAsyncClient.createShare(shareName).subscribe( diff --git a/storage/client/src/samples/java/file/DirectorySample.java b/storage/client/file/src/samples/java/file/DirectorySample.java similarity index 92% rename from storage/client/src/samples/java/file/DirectorySample.java rename to storage/client/file/src/samples/java/file/DirectorySample.java index 986e5e6b30201..134a839dab800 100644 --- a/storage/client/src/samples/java/file/DirectorySample.java +++ b/storage/client/file/src/samples/java/file/DirectorySample.java @@ -5,7 +5,9 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.configuration.ConfigurationManager; import com.azure.storage.file.DirectoryClient; +import com.azure.storage.file.DirectoryClientBuilder; import com.azure.storage.file.ShareClient; +import com.azure.storage.file.ShareClientBuilder; import com.azure.storage.file.models.DirectoryProperties; import com.azure.storage.file.models.StorageErrorException; import java.util.UUID; @@ -24,12 +26,12 @@ private static String generateRandomName() { public static void main(String[] args) { String shareName = generateRandomName(); - ShareClient shareClient = ShareClient.builder().endpoint(ENDPOINT).shareName(shareName).build(); + ShareClient shareClient = new ShareClientBuilder().endpoint(ENDPOINT).shareName(shareName).buildClient(); shareClient.create(); // Build up a directory client - DirectoryClient directoryClient = DirectoryClient.builder().endpoint(ENDPOINT).shareName(generateRandomName()) + DirectoryClient directoryClient = new DirectoryClientBuilder().endpoint(ENDPOINT).shareName(generateRandomName()) .shareName(shareName) - .directoryName(generateRandomName()).build(); + .directoryName(generateRandomName()).buildClient(); // Create a parent directory try { directoryClient.create(); diff --git a/storage/client/src/samples/java/file/FileSample.java b/storage/client/file/src/samples/java/file/FileSample.java similarity index 91% rename from storage/client/src/samples/java/file/FileSample.java rename to storage/client/file/src/samples/java/file/FileSample.java index 2a14436a55906..c27886d584f1e 100644 --- a/storage/client/src/samples/java/file/FileSample.java +++ b/storage/client/file/src/samples/java/file/FileSample.java @@ -5,7 +5,9 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.configuration.ConfigurationManager; import com.azure.storage.file.FileClient; +import com.azure.storage.file.FileClientBuilder; import com.azure.storage.file.ShareClient; +import com.azure.storage.file.ShareClientBuilder; import com.azure.storage.file.models.CopyStatusType; import com.azure.storage.file.models.FileCopyInfo; import com.azure.storage.file.models.FileProperties; @@ -34,15 +36,15 @@ private static String generateRandomName() { public static void main(String[] args) { String shareName = generateRandomName(); - ShareClient shareClient = ShareClient.builder().endpoint(ENDPOINT).shareName(shareName).build(); + ShareClient shareClient = new ShareClientBuilder().endpoint(ENDPOINT).shareName(shareName).buildClient(); shareClient.create(); String parentDirName = generateRandomName(); shareClient.createDirectory(parentDirName); // Create a source file client String srcFileName = generateRandomName(); - FileClient srcFileClient = FileClient.builder().endpoint(ENDPOINT).shareName(shareName) - .filePath(parentDirName + "/" + srcFileName).build(); + FileClient srcFileClient = new FileClientBuilder().endpoint(ENDPOINT).shareName(shareName) + .filePath(parentDirName + "/" + srcFileName).buildClient(); // Create a source file try { @@ -61,8 +63,8 @@ public static void main(String[] args) { } // Create a destination file client. String destFileName = generateRandomName(); - FileClient destFileClient = FileClient.builder().endpoint(ENDPOINT).shareName(shareName) - .filePath(parentDirName + "/" + destFileName).build(); + FileClient destFileClient = new FileClientBuilder().endpoint(ENDPOINT).shareName(shareName) + .filePath(parentDirName + "/" + destFileName).buildClient(); destFileClient.create(1024); // Copy the file from source file to destination file. URL clientURL = null; diff --git a/storage/client/src/samples/java/file/FileServiceSample.java b/storage/client/file/src/samples/java/file/FileServiceSample.java similarity index 92% rename from storage/client/src/samples/java/file/FileServiceSample.java rename to storage/client/file/src/samples/java/file/FileServiceSample.java index 36a7df2cb0673..a68b764908d4e 100644 --- a/storage/client/src/samples/java/file/FileServiceSample.java +++ b/storage/client/file/src/samples/java/file/FileServiceSample.java @@ -4,8 +4,8 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.storage.file.FileServiceAsyncClient; import com.azure.storage.file.FileServiceClient; +import com.azure.storage.file.FileServiceClientBuilder; import com.azure.storage.file.models.FileServiceProperties; import com.azure.storage.file.models.StorageErrorException; import java.util.UUID; @@ -23,8 +23,8 @@ private static String generateRandomName() { public static void main(String[] args) { // Create a file service client. - FileServiceClient fileServiceClient = FileServiceAsyncClient.builder() - .connectionString(CONNECTION_STRING).build(); + FileServiceClient fileServiceClient = new FileServiceClientBuilder() + .connectionString(CONNECTION_STRING).buildClient(); // Create 3 shares for (int i = 0; i < 3; i++) { diff --git a/storage/client/src/samples/java/file/ShareSample.java b/storage/client/file/src/samples/java/file/ShareSample.java similarity index 97% rename from storage/client/src/samples/java/file/ShareSample.java rename to storage/client/file/src/samples/java/file/ShareSample.java index 3e2b96ae30430..2df4819b5b3c0 100644 --- a/storage/client/src/samples/java/file/ShareSample.java +++ b/storage/client/file/src/samples/java/file/ShareSample.java @@ -5,6 +5,7 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.configuration.ConfigurationManager; import com.azure.storage.file.ShareClient; +import com.azure.storage.file.ShareClientBuilder; import com.azure.storage.file.models.ShareProperties; import com.azure.storage.file.models.StorageErrorException; import java.util.UUID; @@ -23,8 +24,8 @@ private static String generateRandomName() { public static void main(String[] args) { // Build a share client String shareName = generateRandomName(); - ShareClient shareClient = ShareClient.builder().endpoint(ENDPOINT). - shareName(shareName).build(); + ShareClient shareClient = new ShareClientBuilder().endpoint(ENDPOINT). + shareName(shareName).buildClient(); // Create first snapshot on share. String shareSnapshot1 = null; diff --git a/storage/client/src/test/java/com/azure/storage/file/DirectoryAsyncClientTests.java b/storage/client/file/src/test/java/com/azure/storage/file/DirectoryAsyncClientTests.java similarity index 96% rename from storage/client/src/test/java/com/azure/storage/file/DirectoryAsyncClientTests.java rename to storage/client/file/src/test/java/com/azure/storage/file/DirectoryAsyncClientTests.java index df192b3e49cfb..2068cb7556e03 100644 --- a/storage/client/src/test/java/com/azure/storage/file/DirectoryAsyncClientTests.java +++ b/storage/client/file/src/test/java/com/azure/storage/file/DirectoryAsyncClientTests.java @@ -28,16 +28,16 @@ public class DirectoryAsyncClientTests extends DirectoryClientTestBase { public void beforeTest() { beforeDirectoryTest(); if (interceptorManager.isPlaybackMode()) { - client = setupClient((connectionString, endpoint) -> DirectoryAsyncClient.builder() + client = setupClient((connectionString, endpoint) -> new DirectoryClientBuilder() .connectionString(connectionString) .endpoint(endpoint) .shareName(shareName) .directoryName(dirName) .httpClient(interceptorManager.getPlaybackClient()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsync(), true, directoryAsyncLogger); + .buildAsyncClient(), true, directoryAsyncLogger); } else { - client = setupClient((connectionString, endpoint) -> DirectoryAsyncClient.builder() + client = setupClient((connectionString, endpoint) -> new DirectoryClientBuilder() .connectionString(connectionString) .endpoint(endpoint) .shareName(shareName) @@ -45,7 +45,7 @@ public void beforeTest() { .httpClient(HttpClient.createDefault().wiretap(true)) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .addPolicy(interceptorManager.getRecordPolicy()) - .buildAsync(), false, directoryAsyncLogger); + .buildAsyncClient(), false, directoryAsyncLogger); } } @@ -54,9 +54,9 @@ public static void beforeClass() { if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { return; } - FileServiceClient fileServiceClient = FileServiceClient.builder() + FileServiceClient fileServiceClient = new FileServiceClientBuilder() .connectionString(ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING")) - .build(); + .buildClient(); shareClient = fileServiceClient.getShareClient(shareName); shareClient.create(); } @@ -67,7 +67,7 @@ public static void tearDown() { return; } shareClient.delete(null); - FileTestHelpers.sleep(Duration.ofSeconds(45)); + FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); } @Override diff --git a/storage/client/src/test/java/com/azure/storage/file/DirectoryClientTestBase.java b/storage/client/file/src/test/java/com/azure/storage/file/DirectoryClientTestBase.java similarity index 100% rename from storage/client/src/test/java/com/azure/storage/file/DirectoryClientTestBase.java rename to storage/client/file/src/test/java/com/azure/storage/file/DirectoryClientTestBase.java diff --git a/storage/client/src/test/java/com/azure/storage/file/DirectoryClientTests.java b/storage/client/file/src/test/java/com/azure/storage/file/DirectoryClientTests.java similarity index 95% rename from storage/client/src/test/java/com/azure/storage/file/DirectoryClientTests.java rename to storage/client/file/src/test/java/com/azure/storage/file/DirectoryClientTests.java index 8132386d36d71..731cbe85984a8 100644 --- a/storage/client/src/test/java/com/azure/storage/file/DirectoryClientTests.java +++ b/storage/client/file/src/test/java/com/azure/storage/file/DirectoryClientTests.java @@ -28,16 +28,16 @@ public class DirectoryClientTests extends DirectoryClientTestBase { public void beforeTest() { beforeDirectoryTest(); if (interceptorManager.isPlaybackMode()) { - directoryClient = setupClient((connectionString, endpoint) -> DirectoryClient.builder() + directoryClient = setupClient((connectionString, endpoint) -> new DirectoryClientBuilder() .connectionString(connectionString) .endpoint(endpoint) .shareName(shareName) .directoryName(dirName) .httpClient(interceptorManager.getPlaybackClient()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .build(), true, directoryLogger); + .buildClient(), true, directoryLogger); } else { - directoryClient = setupClient((connectionString, endpoint) -> DirectoryClient.builder() + directoryClient = setupClient((connectionString, endpoint) -> new DirectoryClientBuilder() .connectionString(connectionString) .endpoint(endpoint) .shareName(shareName) @@ -45,7 +45,7 @@ public void beforeTest() { .httpClient(HttpClient.createDefault().wiretap(true)) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .addPolicy(interceptorManager.getRecordPolicy()) - .build(), false, directoryLogger); + .buildClient(), false, directoryLogger); } } @@ -54,9 +54,9 @@ public static void beforeClass() { if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { return; } - FileServiceClient fileServiceClient = FileServiceClient.builder() + FileServiceClient fileServiceClient = new FileServiceClientBuilder() .connectionString(ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING")) - .build(); + .buildClient(); shareClient = fileServiceClient.getShareClient(shareName); shareClient.create(); } @@ -67,7 +67,7 @@ public static void tearDown() { return; } shareClient.delete(null); - FileTestHelpers.sleep(Duration.ofSeconds(45)); + FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); } @Override diff --git a/storage/client/src/test/java/com/azure/storage/file/FileAsyncClientTest.java b/storage/client/file/src/test/java/com/azure/storage/file/FileAsyncClientTest.java similarity index 95% rename from storage/client/src/test/java/com/azure/storage/file/FileAsyncClientTest.java rename to storage/client/file/src/test/java/com/azure/storage/file/FileAsyncClientTest.java index d6e9fe6782bb8..a6b606599f3fc 100644 --- a/storage/client/src/test/java/com/azure/storage/file/FileAsyncClientTest.java +++ b/storage/client/file/src/test/java/com/azure/storage/file/FileAsyncClientTest.java @@ -34,16 +34,16 @@ public class FileAsyncClientTest extends FileClientTestBase { public void beforeTest() { filePath = dirName + testResourceNamer.randomName("file", 16); if (interceptorManager.isPlaybackMode()) { - fileAsyncClient = setupClient((connectionString, endpoint) -> FileAsyncClient.builder() + fileAsyncClient = setupClient((connectionString, endpoint) -> new FileClientBuilder() .connectionString(connectionString) .shareName(shareName) .filePath(filePath) .endpoint(endpoint) .httpClient(interceptorManager.getPlaybackClient()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsync(), true, fileAsyncLogger); + .buildAsyncClient(), true, fileAsyncLogger); } else { - fileAsyncClient = setupClient((connectionString, endpoint) -> FileAsyncClient.builder() + fileAsyncClient = setupClient((connectionString, endpoint) -> new FileClientBuilder() .connectionString(connectionString) .shareName(shareName) .filePath(filePath) @@ -51,7 +51,7 @@ public void beforeTest() { .httpClient(HttpClient.createDefault().wiretap(true)) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .addPolicy(interceptorManager.getRecordPolicy()) - .buildAsync(), false, fileAsyncLogger); + .buildAsyncClient(), false, fileAsyncLogger); } } @BeforeClass @@ -59,9 +59,9 @@ public static void beforeClass() { if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { return; } - FileServiceClient fileServiceClient = FileServiceClient.builder() + FileServiceClient fileServiceClient = new FileServiceClientBuilder() .connectionString(ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING")) - .build(); + .buildClient(); shareClient = fileServiceClient.getShareClient(shareName); shareClient.create(); shareClient.createDirectory(dirName); @@ -73,7 +73,7 @@ public static void tearDown() { return; } shareClient.delete(null); - FileTestHelpers.sleep(Duration.ofSeconds(45)); + FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); } @Override diff --git a/storage/client/src/test/java/com/azure/storage/file/FileClientTest.java b/storage/client/file/src/test/java/com/azure/storage/file/FileClientTest.java similarity index 95% rename from storage/client/src/test/java/com/azure/storage/file/FileClientTest.java rename to storage/client/file/src/test/java/com/azure/storage/file/FileClientTest.java index 7ac42e2d7b24a..95eed5db9b2a2 100644 --- a/storage/client/src/test/java/com/azure/storage/file/FileClientTest.java +++ b/storage/client/file/src/test/java/com/azure/storage/file/FileClientTest.java @@ -37,16 +37,16 @@ public class FileClientTest extends FileClientTestBase { public void beforeTest() { filePath = dirName + testResourceNamer.randomName("file", 16); if (interceptorManager.isPlaybackMode()) { - fileClient = setupClient((connectionString, endpoint) -> FileClient.builder() + fileClient = setupClient((connectionString, endpoint) -> new FileClientBuilder() .connectionString(connectionString) .shareName(shareName) .filePath(filePath) .endpoint(endpoint) .httpClient(interceptorManager.getPlaybackClient()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .build(), true, fileLogger); + .buildClient(), true, fileLogger); } else { - fileClient = setupClient((connectionString, endpoint) -> FileClient.builder() + fileClient = setupClient((connectionString, endpoint) -> new FileClientBuilder() .connectionString(connectionString) .shareName(shareName) .filePath(filePath) @@ -54,7 +54,7 @@ public void beforeTest() { .httpClient(HttpClient.createDefault().wiretap(true)) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .addPolicy(interceptorManager.getRecordPolicy()) - .build(), false, fileLogger); + .buildClient(), false, fileLogger); } } @BeforeClass @@ -62,9 +62,9 @@ public static void beforeClass() { if (FileTestHelpers.getTestMode() == TestMode.PLAYBACK) { return; } - FileServiceClient fileServiceClient = FileServiceClient.builder() + FileServiceClient fileServiceClient = new FileServiceClientBuilder() .connectionString(ConfigurationManager.getConfiguration().get("AZURE_STORAGE_CONNECTION_STRING")) - .build(); + .buildClient(); shareClient = fileServiceClient.getShareClient(shareName); shareClient.create(); shareClient.createDirectory(dirName); @@ -76,7 +76,7 @@ public static void tearDown() { return; } shareClient.delete(null); - FileTestHelpers.sleep(Duration.ofSeconds(45)); + FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); } @Override diff --git a/storage/client/src/test/java/com/azure/storage/file/FileClientTestBase.java b/storage/client/file/src/test/java/com/azure/storage/file/FileClientTestBase.java similarity index 100% rename from storage/client/src/test/java/com/azure/storage/file/FileClientTestBase.java rename to storage/client/file/src/test/java/com/azure/storage/file/FileClientTestBase.java diff --git a/storage/client/src/test/java/com/azure/storage/file/FileServiceClientAsyncTests.java b/storage/client/file/src/test/java/com/azure/storage/file/FileServiceClientAsyncTests.java similarity index 98% rename from storage/client/src/test/java/com/azure/storage/file/FileServiceClientAsyncTests.java rename to storage/client/file/src/test/java/com/azure/storage/file/FileServiceClientAsyncTests.java index 8182724631d05..f89386ca40779 100644 --- a/storage/client/src/test/java/com/azure/storage/file/FileServiceClientAsyncTests.java +++ b/storage/client/file/src/test/java/com/azure/storage/file/FileServiceClientAsyncTests.java @@ -35,20 +35,20 @@ public void beforeTest() { shareName = getShareName(); if (interceptorManager.isPlaybackMode()) { - fileServiceAsyncClient = setupClient((connectionString, endpoint) -> FileServiceAsyncClient.builder() + fileServiceAsyncClient = setupClient((connectionString, endpoint) -> new FileServiceClientBuilder() .connectionString(connectionString) .endpoint(endpoint) .httpClient(interceptorManager.getPlaybackClient()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsync(), true, fileServiceAsyncLogger); + .buildAsyncClient(), true, fileServiceAsyncLogger); } else { - fileServiceAsyncClient = setupClient((connectionString, endpoint) -> FileServiceAsyncClient.builder() + fileServiceAsyncClient = setupClient((connectionString, endpoint) -> new FileServiceClientBuilder() .connectionString(connectionString) .endpoint(endpoint) .httpClient(HttpClient.createDefault().wiretap(true)) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .addPolicy(interceptorManager.getRecordPolicy()) - .buildAsync(), false, fileServiceAsyncLogger); + .buildAsyncClient(), false, fileServiceAsyncLogger); } } @@ -143,7 +143,7 @@ public void deleteThenCreateShareFromFileServiceClient() { .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) .verifyComplete(); - FileTestHelpers.sleep(Duration.ofSeconds(45)); + FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); StepVerifier.create(fileServiceAsyncClient.createShare(shareName)) .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) diff --git a/storage/client/src/test/java/com/azure/storage/file/FileServiceClientTestBase.java b/storage/client/file/src/test/java/com/azure/storage/file/FileServiceClientTestBase.java similarity index 100% rename from storage/client/src/test/java/com/azure/storage/file/FileServiceClientTestBase.java rename to storage/client/file/src/test/java/com/azure/storage/file/FileServiceClientTestBase.java diff --git a/storage/client/src/test/java/com/azure/storage/file/FileServiceClientTests.java b/storage/client/file/src/test/java/com/azure/storage/file/FileServiceClientTests.java similarity index 98% rename from storage/client/src/test/java/com/azure/storage/file/FileServiceClientTests.java rename to storage/client/file/src/test/java/com/azure/storage/file/FileServiceClientTests.java index fb19ab8c1e641..06af49a7c3481 100644 --- a/storage/client/src/test/java/com/azure/storage/file/FileServiceClientTests.java +++ b/storage/client/file/src/test/java/com/azure/storage/file/FileServiceClientTests.java @@ -39,20 +39,20 @@ public void beforeTest() { shareName = getShareName(); if (interceptorManager.isPlaybackMode()) { - fileServiceClient = setupClient((connectionString, endpoint) -> FileServiceAsyncClient.builder() + fileServiceClient = setupClient((connectionString, endpoint) -> new FileServiceClientBuilder() .connectionString(connectionString) .endpoint(endpoint) .httpClient(interceptorManager.getPlaybackClient()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .build(), true, fileServiceLogger); + .buildClient(), true, fileServiceLogger); } else { - fileServiceClient = setupClient((connectionString, endpoint) -> FileServiceAsyncClient.builder() + fileServiceClient = setupClient((connectionString, endpoint) -> new FileServiceClientBuilder() .connectionString(connectionString) .endpoint(endpoint) .httpClient(HttpClient.createDefault().wiretap(true)) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .addPolicy(interceptorManager.getRecordPolicy()) - .build(), false, fileServiceLogger); + .buildClient(), false, fileServiceLogger); } } @@ -147,7 +147,7 @@ public void deleteThenCreateShareFromFileServiceClient() { FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(shareName), 201); FileTestHelpers.assertResponseStatusCode(fileServiceClient.deleteShare(shareName), 202); - FileTestHelpers.sleep(Duration.ofSeconds(45)); + FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); FileTestHelpers.assertResponseStatusCode(fileServiceClient.createShare(shareName), 201); } diff --git a/storage/client/src/test/java/com/azure/storage/file/FileTestHelpers.java b/storage/client/file/src/test/java/com/azure/storage/file/FileTestHelpers.java similarity index 97% rename from storage/client/src/test/java/com/azure/storage/file/FileTestHelpers.java rename to storage/client/file/src/test/java/com/azure/storage/file/FileTestHelpers.java index 6e247b65cb893..8621b5ccc2f26 100644 --- a/storage/client/src/test/java/com/azure/storage/file/FileTestHelpers.java +++ b/storage/client/file/src/test/java/com/azure/storage/file/FileTestHelpers.java @@ -42,7 +42,7 @@ static T setupClient(BiFunction clientBuilder, boolean is } if (ImplUtils.isNullOrEmpty(connectionString) && ImplUtils.isNullOrEmpty(endpoint)) { - logger.asWarning().log("Connection string or endpoint must be set to build the testing client"); + logger.asWarning().log("Connection string or endpoint must be set to buildClient the testing client"); fail(); return null; } @@ -80,6 +80,12 @@ static void assertExceptionStatusCode(Runnable thrower, int expectedStatusCode) } } + static void sleepInRecordMode(Duration duration) { + if(getTestMode() == TestMode.RECORD) { + sleep(duration); + } + } + static void sleep(Duration duration) { try { Thread.sleep(duration.toMillis()); diff --git a/storage/client/src/test/java/com/azure/storage/file/LargeFileTest.java b/storage/client/file/src/test/java/com/azure/storage/file/LargeFileTest.java similarity index 95% rename from storage/client/src/test/java/com/azure/storage/file/LargeFileTest.java rename to storage/client/file/src/test/java/com/azure/storage/file/LargeFileTest.java index 5471d833f1b3b..d85b40a0e3127 100644 --- a/storage/client/src/test/java/com/azure/storage/file/LargeFileTest.java +++ b/storage/client/file/src/test/java/com/azure/storage/file/LargeFileTest.java @@ -51,8 +51,8 @@ public void setup() { largeFileLogger.asWarning().log("Failed to create the large file dir."); } String shareName = testResourceNamer.randomName("largefileshare", 32); - shareClient = ShareClient.builder().connectionString(azureStorageConnectionString).shareName(shareName) - .build(); + shareClient = new ShareClientBuilder().connectionString(azureStorageConnectionString).shareName(shareName) + .buildClient(); shareClient.create(); shareClient.createDirectory("largefiledir"); largeFileClient = shareClient.getDirectoryClient("largefiledir").getFileClient(fileName); @@ -89,7 +89,7 @@ public void uploadAndDownloadLargeFile() throws Exception { public void cleanUp() { assumeTrue("The test is only for live mode.", FileTestHelpers.getTestMode() == TestMode.RECORD); shareClient.delete(); - FileTestHelpers.sleep(Duration.ofSeconds(45)); + FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); } private String getFileChecksum(File file) throws Exception { diff --git a/storage/client/src/test/java/com/azure/storage/file/ShareAsyncClientTests.java b/storage/client/file/src/test/java/com/azure/storage/file/ShareAsyncClientTests.java similarity index 98% rename from storage/client/src/test/java/com/azure/storage/file/ShareAsyncClientTests.java rename to storage/client/file/src/test/java/com/azure/storage/file/ShareAsyncClientTests.java index ee3ca646e763d..c34acc6ff6c32 100644 --- a/storage/client/src/test/java/com/azure/storage/file/ShareAsyncClientTests.java +++ b/storage/client/file/src/test/java/com/azure/storage/file/ShareAsyncClientTests.java @@ -36,22 +36,22 @@ public void beforeTest() { shareName = getShareName(); if (interceptorManager.isPlaybackMode()) { - shareAsyncClient = setupClient((connectionString, endpoint) -> ShareAsyncClient.builder() + shareAsyncClient = setupClient((connectionString, endpoint) -> new ShareClientBuilder() .connectionString(connectionString) .endpoint(endpoint) .shareName(shareName) .httpClient(interceptorManager.getPlaybackClient()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .buildAsync(), true, shareAsyncLogger); + .buildAsyncClient(), true, shareAsyncLogger); } else { - shareAsyncClient = setupClient((connectionString, endpoint) -> ShareAsyncClient.builder() + shareAsyncClient = setupClient((connectionString, endpoint) -> new ShareClientBuilder() .connectionString(connectionString) .endpoint(endpoint) .shareName(shareName) .httpClient(HttpClient.createDefault().wiretap(true)) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .addPolicy(interceptorManager.getRecordPolicy()) - .buildAsync(), false, shareAsyncLogger); + .buildAsyncClient(), false, shareAsyncLogger); } } @@ -188,7 +188,7 @@ public void deleteThenCreateFromShareClient() { .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 202)) .verifyComplete(); - FileTestHelpers.sleep(Duration.ofSeconds(45)); + FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); StepVerifier.create(shareAsyncClient.create()) .assertNext(response -> FileTestHelpers.assertResponseStatusCode(response, 201)) diff --git a/storage/client/src/test/java/com/azure/storage/file/ShareClientTestBase.java b/storage/client/file/src/test/java/com/azure/storage/file/ShareClientTestBase.java similarity index 100% rename from storage/client/src/test/java/com/azure/storage/file/ShareClientTestBase.java rename to storage/client/file/src/test/java/com/azure/storage/file/ShareClientTestBase.java diff --git a/storage/client/src/test/java/com/azure/storage/file/ShareClientTests.java b/storage/client/file/src/test/java/com/azure/storage/file/ShareClientTests.java similarity index 98% rename from storage/client/src/test/java/com/azure/storage/file/ShareClientTests.java rename to storage/client/file/src/test/java/com/azure/storage/file/ShareClientTests.java index 863292bf63973..442b59fd2d1e0 100644 --- a/storage/client/src/test/java/com/azure/storage/file/ShareClientTests.java +++ b/storage/client/file/src/test/java/com/azure/storage/file/ShareClientTests.java @@ -38,22 +38,22 @@ public void beforeTest() { shareName = getShareName(); if (interceptorManager.isPlaybackMode()) { - shareClient = setupClient((connectionString, endpoint) -> ShareClient.builder() + shareClient = setupClient((connectionString, endpoint) -> new ShareClientBuilder() .connectionString(connectionString) .endpoint(endpoint) .shareName(shareName) .httpClient(interceptorManager.getPlaybackClient()) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) - .build(), true, shareLogger); + .buildClient(), true, shareLogger); } else { - shareClient = setupClient((connectionString, endpoint) -> ShareClient.builder() + shareClient = setupClient((connectionString, endpoint) -> new ShareClientBuilder() .connectionString(connectionString) .endpoint(endpoint) .shareName(shareName) .httpClient(HttpClient.createDefault().wiretap(true)) .httpLogDetailLevel(HttpLogDetailLevel.BODY_AND_HEADERS) .addPolicy(interceptorManager.getRecordPolicy()) - .build(), false, shareLogger); + .buildClient(), false, shareLogger); } } @@ -170,7 +170,7 @@ public void deleteThenCreateFromShareClient() { FileTestHelpers.assertResponseStatusCode(shareClient.delete(), 202); - FileTestHelpers.sleep(Duration.ofSeconds(45)); + FileTestHelpers.sleepInRecordMode(Duration.ofSeconds(45)); FileTestHelpers.assertResponseStatusCode(shareClient.create(), 201); } diff --git a/storage/client/src/test/resources/session-records/abortCopy.json b/storage/client/file/src/test/resources/session-records/abortCopy.json similarity index 100% rename from storage/client/src/test/resources/session-records/abortCopy.json rename to storage/client/file/src/test/resources/session-records/abortCopy.json diff --git a/storage/client/src/test/resources/session-records/clearMetadataFromDirClient.json b/storage/client/file/src/test/resources/session-records/clearMetadataFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/clearMetadataFromDirClient.json rename to storage/client/file/src/test/resources/session-records/clearMetadataFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/create.json b/storage/client/file/src/test/resources/session-records/create.json similarity index 100% rename from storage/client/src/test/resources/session-records/create.json rename to storage/client/file/src/test/resources/session-records/create.json diff --git a/storage/client/src/test/resources/session-records/createDirectory.json b/storage/client/file/src/test/resources/session-records/createDirectory.json similarity index 100% rename from storage/client/src/test/resources/session-records/createDirectory.json rename to storage/client/file/src/test/resources/session-records/createDirectory.json diff --git a/storage/client/src/test/resources/session-records/createDirectoryAlreadyExists.json b/storage/client/file/src/test/resources/session-records/createDirectoryAlreadyExists.json similarity index 100% rename from storage/client/src/test/resources/session-records/createDirectoryAlreadyExists.json rename to storage/client/file/src/test/resources/session-records/createDirectoryAlreadyExists.json diff --git a/storage/client/src/test/resources/session-records/createDirectoryAlreadyExistsFromShareClient.json b/storage/client/file/src/test/resources/session-records/createDirectoryAlreadyExistsFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/createDirectoryAlreadyExistsFromShareClient.json rename to storage/client/file/src/test/resources/session-records/createDirectoryAlreadyExistsFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/createDirectoryFromShareClient.json b/storage/client/file/src/test/resources/session-records/createDirectoryFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/createDirectoryFromShareClient.json rename to storage/client/file/src/test/resources/session-records/createDirectoryFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/createDirectoryInvalidName.json b/storage/client/file/src/test/resources/session-records/createDirectoryInvalidName.json similarity index 100% rename from storage/client/src/test/resources/session-records/createDirectoryInvalidName.json rename to storage/client/file/src/test/resources/session-records/createDirectoryInvalidName.json diff --git a/storage/client/src/test/resources/session-records/createDirectoryInvalidNameFromShareClient.json b/storage/client/file/src/test/resources/session-records/createDirectoryInvalidNameFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/createDirectoryInvalidNameFromShareClient.json rename to storage/client/file/src/test/resources/session-records/createDirectoryInvalidNameFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/createExcessMaxSize.json b/storage/client/file/src/test/resources/session-records/createExcessMaxSize.json similarity index 100% rename from storage/client/src/test/resources/session-records/createExcessMaxSize.json rename to storage/client/file/src/test/resources/session-records/createExcessMaxSize.json diff --git a/storage/client/src/test/resources/session-records/createExcessMaxSizeFromFileClient.json b/storage/client/file/src/test/resources/session-records/createExcessMaxSizeFromFileClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/createExcessMaxSizeFromFileClient.json rename to storage/client/file/src/test/resources/session-records/createExcessMaxSizeFromFileClient.json diff --git a/storage/client/src/test/resources/session-records/createFile.json b/storage/client/file/src/test/resources/session-records/createFile.json similarity index 100% rename from storage/client/src/test/resources/session-records/createFile.json rename to storage/client/file/src/test/resources/session-records/createFile.json diff --git a/storage/client/src/test/resources/session-records/createFileFromDirClient.json b/storage/client/file/src/test/resources/session-records/createFileFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/createFileFromDirClient.json rename to storage/client/file/src/test/resources/session-records/createFileFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/createFileWithoutCreateDirFromDirClient.json b/storage/client/file/src/test/resources/session-records/createFileWithoutCreateDirFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/createFileWithoutCreateDirFromDirClient.json rename to storage/client/file/src/test/resources/session-records/createFileWithoutCreateDirFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/createFromFileClient.json b/storage/client/file/src/test/resources/session-records/createFromFileClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/createFromFileClient.json rename to storage/client/file/src/test/resources/session-records/createFromFileClient.json diff --git a/storage/client/src/test/resources/session-records/createFromShareClient.json b/storage/client/file/src/test/resources/session-records/createFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/createFromShareClient.json rename to storage/client/file/src/test/resources/session-records/createFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/createInvalidQuota.json b/storage/client/file/src/test/resources/session-records/createInvalidQuota.json similarity index 100% rename from storage/client/src/test/resources/session-records/createInvalidQuota.json rename to storage/client/file/src/test/resources/session-records/createInvalidQuota.json diff --git a/storage/client/src/test/resources/session-records/createInvalidQuotaFromShareClient.json b/storage/client/file/src/test/resources/session-records/createInvalidQuotaFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/createInvalidQuotaFromShareClient.json rename to storage/client/file/src/test/resources/session-records/createInvalidQuotaFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/createMTwiceFromDirClient.json b/storage/client/file/src/test/resources/session-records/createMTwiceFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/createMTwiceFromDirClient.json rename to storage/client/file/src/test/resources/session-records/createMTwiceFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/createMin.json b/storage/client/file/src/test/resources/session-records/createMin.json similarity index 100% rename from storage/client/src/test/resources/session-records/createMin.json rename to storage/client/file/src/test/resources/session-records/createMin.json diff --git a/storage/client/src/test/resources/session-records/createMinFromDirClient.json b/storage/client/file/src/test/resources/session-records/createMinFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/createMinFromDirClient.json rename to storage/client/file/src/test/resources/session-records/createMinFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/createShare.json b/storage/client/file/src/test/resources/session-records/createShare.json similarity index 100% rename from storage/client/src/test/resources/session-records/createShare.json rename to storage/client/file/src/test/resources/session-records/createShare.json diff --git a/storage/client/src/test/resources/session-records/createShareInvalidQuota.json b/storage/client/file/src/test/resources/session-records/createShareInvalidQuota.json similarity index 100% rename from storage/client/src/test/resources/session-records/createShareInvalidQuota.json rename to storage/client/file/src/test/resources/session-records/createShareInvalidQuota.json diff --git a/storage/client/src/test/resources/session-records/createShareTwiceDifferentMetadata.json b/storage/client/file/src/test/resources/session-records/createShareTwiceDifferentMetadata.json similarity index 100% rename from storage/client/src/test/resources/session-records/createShareTwiceDifferentMetadata.json rename to storage/client/file/src/test/resources/session-records/createShareTwiceDifferentMetadata.json diff --git a/storage/client/src/test/resources/session-records/createShareTwiceSameMetadata.json b/storage/client/file/src/test/resources/session-records/createShareTwiceSameMetadata.json similarity index 100% rename from storage/client/src/test/resources/session-records/createShareTwiceSameMetadata.json rename to storage/client/file/src/test/resources/session-records/createShareTwiceSameMetadata.json diff --git a/storage/client/src/test/resources/session-records/createSubDirectory.json b/storage/client/file/src/test/resources/session-records/createSubDirectory.json similarity index 100% rename from storage/client/src/test/resources/session-records/createSubDirectory.json rename to storage/client/file/src/test/resources/session-records/createSubDirectory.json diff --git a/storage/client/src/test/resources/session-records/createSubDirectoryTwiceSameMetadata.json b/storage/client/file/src/test/resources/session-records/createSubDirectoryTwiceSameMetadata.json similarity index 100% rename from storage/client/src/test/resources/session-records/createSubDirectoryTwiceSameMetadata.json rename to storage/client/file/src/test/resources/session-records/createSubDirectoryTwiceSameMetadata.json diff --git a/storage/client/src/test/resources/session-records/createSubDirectoryWithMetadata.json b/storage/client/file/src/test/resources/session-records/createSubDirectoryWithMetadata.json similarity index 100% rename from storage/client/src/test/resources/session-records/createSubDirectoryWithMetadata.json rename to storage/client/file/src/test/resources/session-records/createSubDirectoryWithMetadata.json diff --git a/storage/client/src/test/resources/session-records/createTwiceDifferentMetadata.json b/storage/client/file/src/test/resources/session-records/createTwiceDifferentMetadata.json similarity index 100% rename from storage/client/src/test/resources/session-records/createTwiceDifferentMetadata.json rename to storage/client/file/src/test/resources/session-records/createTwiceDifferentMetadata.json diff --git a/storage/client/src/test/resources/session-records/createTwiceDifferentMetadataFromShareClient.json b/storage/client/file/src/test/resources/session-records/createTwiceDifferentMetadataFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/createTwiceDifferentMetadataFromShareClient.json rename to storage/client/file/src/test/resources/session-records/createTwiceDifferentMetadataFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/createTwiceFromDirClient.json b/storage/client/file/src/test/resources/session-records/createTwiceFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/createTwiceFromDirClient.json rename to storage/client/file/src/test/resources/session-records/createTwiceFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/createTwiceSameMetadata.json b/storage/client/file/src/test/resources/session-records/createTwiceSameMetadata.json similarity index 100% rename from storage/client/src/test/resources/session-records/createTwiceSameMetadata.json rename to storage/client/file/src/test/resources/session-records/createTwiceSameMetadata.json diff --git a/storage/client/src/test/resources/session-records/createTwiceSameMetadataFromShareClient.json b/storage/client/file/src/test/resources/session-records/createTwiceSameMetadataFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/createTwiceSameMetadataFromShareClient.json rename to storage/client/file/src/test/resources/session-records/createTwiceSameMetadataFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/createWithMetadata.json b/storage/client/file/src/test/resources/session-records/createWithMetadata.json similarity index 100% rename from storage/client/src/test/resources/session-records/createWithMetadata.json rename to storage/client/file/src/test/resources/session-records/createWithMetadata.json diff --git a/storage/client/src/test/resources/session-records/createWithMetadataFromDirClient.json b/storage/client/file/src/test/resources/session-records/createWithMetadataFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/createWithMetadataFromDirClient.json rename to storage/client/file/src/test/resources/session-records/createWithMetadataFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/delete.json b/storage/client/file/src/test/resources/session-records/delete.json similarity index 100% rename from storage/client/src/test/resources/session-records/delete.json rename to storage/client/file/src/test/resources/session-records/delete.json diff --git a/storage/client/src/test/resources/session-records/deleteDirectory.json b/storage/client/file/src/test/resources/session-records/deleteDirectory.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteDirectory.json rename to storage/client/file/src/test/resources/session-records/deleteDirectory.json diff --git a/storage/client/src/test/resources/session-records/deleteDirectoryDoesNotExist.json b/storage/client/file/src/test/resources/session-records/deleteDirectoryDoesNotExist.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteDirectoryDoesNotExist.json rename to storage/client/file/src/test/resources/session-records/deleteDirectoryDoesNotExist.json diff --git a/storage/client/src/test/resources/session-records/deleteDirectoryDoesNotExistFromShareClient.json b/storage/client/file/src/test/resources/session-records/deleteDirectoryDoesNotExistFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteDirectoryDoesNotExistFromShareClient.json rename to storage/client/file/src/test/resources/session-records/deleteDirectoryDoesNotExistFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/deleteDirectoryFromShareClient.json b/storage/client/file/src/test/resources/session-records/deleteDirectoryFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteDirectoryFromShareClient.json rename to storage/client/file/src/test/resources/session-records/deleteDirectoryFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/deleteDoesNotExist.json b/storage/client/file/src/test/resources/session-records/deleteDoesNotExist.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteDoesNotExist.json rename to storage/client/file/src/test/resources/session-records/deleteDoesNotExist.json diff --git a/storage/client/src/test/resources/session-records/deleteDoesNotExistFromShareClient.json b/storage/client/file/src/test/resources/session-records/deleteDoesNotExistFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteDoesNotExistFromShareClient.json rename to storage/client/file/src/test/resources/session-records/deleteDoesNotExistFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/deleteFile.json b/storage/client/file/src/test/resources/session-records/deleteFile.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteFile.json rename to storage/client/file/src/test/resources/session-records/deleteFile.json diff --git a/storage/client/src/test/resources/session-records/deleteFileFromDirClient.json b/storage/client/file/src/test/resources/session-records/deleteFileFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteFileFromDirClient.json rename to storage/client/file/src/test/resources/session-records/deleteFileFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/deleteFileWithoutCreateFileFromDirClient.json b/storage/client/file/src/test/resources/session-records/deleteFileWithoutCreateFileFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteFileWithoutCreateFileFromDirClient.json rename to storage/client/file/src/test/resources/session-records/deleteFileWithoutCreateFileFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/deleteFromDirClient.json b/storage/client/file/src/test/resources/session-records/deleteFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteFromDirClient.json rename to storage/client/file/src/test/resources/session-records/deleteFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/deleteFromFileClient.json b/storage/client/file/src/test/resources/session-records/deleteFromFileClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteFromFileClient.json rename to storage/client/file/src/test/resources/session-records/deleteFromFileClient.json diff --git a/storage/client/src/test/resources/session-records/deleteFromShareClient.json b/storage/client/file/src/test/resources/session-records/deleteFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteFromShareClient.json rename to storage/client/file/src/test/resources/session-records/deleteFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/deleteNotExist.json b/storage/client/file/src/test/resources/session-records/deleteNotExist.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteNotExist.json rename to storage/client/file/src/test/resources/session-records/deleteNotExist.json diff --git a/storage/client/src/test/resources/session-records/deleteNotExistFromDirClient.json b/storage/client/file/src/test/resources/session-records/deleteNotExistFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteNotExistFromDirClient.json rename to storage/client/file/src/test/resources/session-records/deleteNotExistFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/deleteShare.json b/storage/client/file/src/test/resources/session-records/deleteShare.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteShare.json rename to storage/client/file/src/test/resources/session-records/deleteShare.json diff --git a/storage/client/src/test/resources/session-records/deleteShareDoesNotExist.json b/storage/client/file/src/test/resources/session-records/deleteShareDoesNotExist.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteShareDoesNotExist.json rename to storage/client/file/src/test/resources/session-records/deleteShareDoesNotExist.json diff --git a/storage/client/src/test/resources/session-records/deleteSnapshot.json b/storage/client/file/src/test/resources/session-records/deleteSnapshot.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteSnapshot.json rename to storage/client/file/src/test/resources/session-records/deleteSnapshot.json diff --git a/storage/client/src/test/resources/session-records/deleteSnapshotFromShareClient.json b/storage/client/file/src/test/resources/session-records/deleteSnapshotFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteSnapshotFromShareClient.json rename to storage/client/file/src/test/resources/session-records/deleteSnapshotFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/deleteSubDirectory.json b/storage/client/file/src/test/resources/session-records/deleteSubDirectory.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteSubDirectory.json rename to storage/client/file/src/test/resources/session-records/deleteSubDirectory.json diff --git a/storage/client/src/test/resources/session-records/deleteThenCreate.json b/storage/client/file/src/test/resources/session-records/deleteThenCreate.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteThenCreate.json rename to storage/client/file/src/test/resources/session-records/deleteThenCreate.json diff --git a/storage/client/src/test/resources/session-records/deleteThenCreateFromShareClient.json b/storage/client/file/src/test/resources/session-records/deleteThenCreateFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteThenCreateFromShareClient.json rename to storage/client/file/src/test/resources/session-records/deleteThenCreateFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/deleteThenCreateShare.json b/storage/client/file/src/test/resources/session-records/deleteThenCreateShare.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteThenCreateShare.json rename to storage/client/file/src/test/resources/session-records/deleteThenCreateShare.json diff --git a/storage/client/src/test/resources/session-records/deleteThenCreateShareFromFileServiceClient.json b/storage/client/file/src/test/resources/session-records/deleteThenCreateShareFromFileServiceClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteThenCreateShareFromFileServiceClient.json rename to storage/client/file/src/test/resources/session-records/deleteThenCreateShareFromFileServiceClient.json diff --git a/storage/client/src/test/resources/session-records/deleteThenCreateShareTooSoon.json b/storage/client/file/src/test/resources/session-records/deleteThenCreateShareTooSoon.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteThenCreateShareTooSoon.json rename to storage/client/file/src/test/resources/session-records/deleteThenCreateShareTooSoon.json diff --git a/storage/client/src/test/resources/session-records/deleteThenCreateShareTooSoonFromFileServiceClient.json b/storage/client/file/src/test/resources/session-records/deleteThenCreateShareTooSoonFromFileServiceClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteThenCreateShareTooSoonFromFileServiceClient.json rename to storage/client/file/src/test/resources/session-records/deleteThenCreateShareTooSoonFromFileServiceClient.json diff --git a/storage/client/src/test/resources/session-records/deleteThenCreateTooSoon.json b/storage/client/file/src/test/resources/session-records/deleteThenCreateTooSoon.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteThenCreateTooSoon.json rename to storage/client/file/src/test/resources/session-records/deleteThenCreateTooSoon.json diff --git a/storage/client/src/test/resources/session-records/deleteThenCreateTooSoonFromShareClient.json b/storage/client/file/src/test/resources/session-records/deleteThenCreateTooSoonFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/deleteThenCreateTooSoonFromShareClient.json rename to storage/client/file/src/test/resources/session-records/deleteThenCreateTooSoonFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/downloadWithProperties.json b/storage/client/file/src/test/resources/session-records/downloadWithProperties.json similarity index 100% rename from storage/client/src/test/resources/session-records/downloadWithProperties.json rename to storage/client/file/src/test/resources/session-records/downloadWithProperties.json diff --git a/storage/client/src/test/resources/session-records/forceCloseHandles.json b/storage/client/file/src/test/resources/session-records/forceCloseHandles.json similarity index 100% rename from storage/client/src/test/resources/session-records/forceCloseHandles.json rename to storage/client/file/src/test/resources/session-records/forceCloseHandles.json diff --git a/storage/client/src/test/resources/session-records/forceCloseHandlesFromDirClient.json b/storage/client/file/src/test/resources/session-records/forceCloseHandlesFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/forceCloseHandlesFromDirClient.json rename to storage/client/file/src/test/resources/session-records/forceCloseHandlesFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/forceCloseHandlesFromFileClient.json b/storage/client/file/src/test/resources/session-records/forceCloseHandlesFromFileClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/forceCloseHandlesFromFileClient.json rename to storage/client/file/src/test/resources/session-records/forceCloseHandlesFromFileClient.json diff --git a/storage/client/src/test/resources/session-records/getDirectoryDoesNotCreateADirectory.json b/storage/client/file/src/test/resources/session-records/getDirectoryDoesNotCreateADirectory.json similarity index 100% rename from storage/client/src/test/resources/session-records/getDirectoryDoesNotCreateADirectory.json rename to storage/client/file/src/test/resources/session-records/getDirectoryDoesNotCreateADirectory.json diff --git a/storage/client/src/test/resources/session-records/getFileClient.json b/storage/client/file/src/test/resources/session-records/getFileClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/getFileClient.json rename to storage/client/file/src/test/resources/session-records/getFileClient.json diff --git a/storage/client/src/test/resources/session-records/getFileClientFromDirClient.json b/storage/client/file/src/test/resources/session-records/getFileClientFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/getFileClientFromDirClient.json rename to storage/client/file/src/test/resources/session-records/getFileClientFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/getHandles.json b/storage/client/file/src/test/resources/session-records/getHandles.json similarity index 100% rename from storage/client/src/test/resources/session-records/getHandles.json rename to storage/client/file/src/test/resources/session-records/getHandles.json diff --git a/storage/client/src/test/resources/session-records/getHandlesFromDirClient.json b/storage/client/file/src/test/resources/session-records/getHandlesFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/getHandlesFromDirClient.json rename to storage/client/file/src/test/resources/session-records/getHandlesFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/getMetadata.json b/storage/client/file/src/test/resources/session-records/getMetadata.json similarity index 100% rename from storage/client/src/test/resources/session-records/getMetadata.json rename to storage/client/file/src/test/resources/session-records/getMetadata.json diff --git a/storage/client/src/test/resources/session-records/getMetadataDoesNotExist.json b/storage/client/file/src/test/resources/session-records/getMetadataDoesNotExist.json similarity index 100% rename from storage/client/src/test/resources/session-records/getMetadataDoesNotExist.json rename to storage/client/file/src/test/resources/session-records/getMetadataDoesNotExist.json diff --git a/storage/client/src/test/resources/session-records/getMetadataDoesNotExistFromShareClient.json b/storage/client/file/src/test/resources/session-records/getMetadataDoesNotExistFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/getMetadataDoesNotExistFromShareClient.json rename to storage/client/file/src/test/resources/session-records/getMetadataDoesNotExistFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/getMetadataFromShareClient.json b/storage/client/file/src/test/resources/session-records/getMetadataFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/getMetadataFromShareClient.json rename to storage/client/file/src/test/resources/session-records/getMetadataFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/getPolicies.json b/storage/client/file/src/test/resources/session-records/getPolicies.json similarity index 100% rename from storage/client/src/test/resources/session-records/getPolicies.json rename to storage/client/file/src/test/resources/session-records/getPolicies.json diff --git a/storage/client/src/test/resources/session-records/getPoliciesDoesNotExist.json b/storage/client/file/src/test/resources/session-records/getPoliciesDoesNotExist.json similarity index 100% rename from storage/client/src/test/resources/session-records/getPoliciesDoesNotExist.json rename to storage/client/file/src/test/resources/session-records/getPoliciesDoesNotExist.json diff --git a/storage/client/src/test/resources/session-records/getProperties.json b/storage/client/file/src/test/resources/session-records/getProperties.json similarity index 100% rename from storage/client/src/test/resources/session-records/getProperties.json rename to storage/client/file/src/test/resources/session-records/getProperties.json diff --git a/storage/client/src/test/resources/session-records/getPropertiesDoesNotExist.json b/storage/client/file/src/test/resources/session-records/getPropertiesDoesNotExist.json similarity index 100% rename from storage/client/src/test/resources/session-records/getPropertiesDoesNotExist.json rename to storage/client/file/src/test/resources/session-records/getPropertiesDoesNotExist.json diff --git a/storage/client/src/test/resources/session-records/getPropertiesDoesNotExistFromShareClient.json b/storage/client/file/src/test/resources/session-records/getPropertiesDoesNotExistFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/getPropertiesDoesNotExistFromShareClient.json rename to storage/client/file/src/test/resources/session-records/getPropertiesDoesNotExistFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/getPropertiesFromDirClient.json b/storage/client/file/src/test/resources/session-records/getPropertiesFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/getPropertiesFromDirClient.json rename to storage/client/file/src/test/resources/session-records/getPropertiesFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/getPropertiesFromFileClient.json b/storage/client/file/src/test/resources/session-records/getPropertiesFromFileClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/getPropertiesFromFileClient.json rename to storage/client/file/src/test/resources/session-records/getPropertiesFromFileClient.json diff --git a/storage/client/src/test/resources/session-records/getPropertiesFromShareClient.json b/storage/client/file/src/test/resources/session-records/getPropertiesFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/getPropertiesFromShareClient.json rename to storage/client/file/src/test/resources/session-records/getPropertiesFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/getPropertiesInvalidSnapshot.json b/storage/client/file/src/test/resources/session-records/getPropertiesInvalidSnapshot.json similarity index 100% rename from storage/client/src/test/resources/session-records/getPropertiesInvalidSnapshot.json rename to storage/client/file/src/test/resources/session-records/getPropertiesInvalidSnapshot.json diff --git a/storage/client/src/test/resources/session-records/getPropertiesInvalidSnapshotFromDirClient.json b/storage/client/file/src/test/resources/session-records/getPropertiesInvalidSnapshotFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/getPropertiesInvalidSnapshotFromDirClient.json rename to storage/client/file/src/test/resources/session-records/getPropertiesInvalidSnapshotFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/getPropertiesNull.json b/storage/client/file/src/test/resources/session-records/getPropertiesNull.json similarity index 100% rename from storage/client/src/test/resources/session-records/getPropertiesNull.json rename to storage/client/file/src/test/resources/session-records/getPropertiesNull.json diff --git a/storage/client/src/test/resources/session-records/getPropertiesNullFromDirClient.json b/storage/client/file/src/test/resources/session-records/getPropertiesNullFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/getPropertiesNullFromDirClient.json rename to storage/client/file/src/test/resources/session-records/getPropertiesNullFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/getPropertiesValidSnapshot.json b/storage/client/file/src/test/resources/session-records/getPropertiesValidSnapshot.json similarity index 100% rename from storage/client/src/test/resources/session-records/getPropertiesValidSnapshot.json rename to storage/client/file/src/test/resources/session-records/getPropertiesValidSnapshot.json diff --git a/storage/client/src/test/resources/session-records/getPropertiesValidSnapshotFromDirClient.json b/storage/client/file/src/test/resources/session-records/getPropertiesValidSnapshotFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/getPropertiesValidSnapshotFromDirClient.json rename to storage/client/file/src/test/resources/session-records/getPropertiesValidSnapshotFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/getRootDirectoryDoesNotCreateADirectory.json b/storage/client/file/src/test/resources/session-records/getRootDirectoryDoesNotCreateADirectory.json similarity index 100% rename from storage/client/src/test/resources/session-records/getRootDirectoryDoesNotCreateADirectory.json rename to storage/client/file/src/test/resources/session-records/getRootDirectoryDoesNotCreateADirectory.json diff --git a/storage/client/src/test/resources/session-records/getShareDoesNotCreateAShare.json b/storage/client/file/src/test/resources/session-records/getShareDoesNotCreateAShare.json similarity index 100% rename from storage/client/src/test/resources/session-records/getShareDoesNotCreateAShare.json rename to storage/client/file/src/test/resources/session-records/getShareDoesNotCreateAShare.json diff --git a/storage/client/src/test/resources/session-records/getSnapshotMetadata.json b/storage/client/file/src/test/resources/session-records/getSnapshotMetadata.json similarity index 100% rename from storage/client/src/test/resources/session-records/getSnapshotMetadata.json rename to storage/client/file/src/test/resources/session-records/getSnapshotMetadata.json diff --git a/storage/client/src/test/resources/session-records/getSnapshotMetadataDoesNotExist.json b/storage/client/file/src/test/resources/session-records/getSnapshotMetadataDoesNotExist.json similarity index 100% rename from storage/client/src/test/resources/session-records/getSnapshotMetadataDoesNotExist.json rename to storage/client/file/src/test/resources/session-records/getSnapshotMetadataDoesNotExist.json diff --git a/storage/client/src/test/resources/session-records/getSnapshotMetadataDoesNotExistFromShareClient.json b/storage/client/file/src/test/resources/session-records/getSnapshotMetadataDoesNotExistFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/getSnapshotMetadataDoesNotExistFromShareClient.json rename to storage/client/file/src/test/resources/session-records/getSnapshotMetadataDoesNotExistFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/getSnapshotMetadataFromShareClient.json b/storage/client/file/src/test/resources/session-records/getSnapshotMetadataFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/getSnapshotMetadataFromShareClient.json rename to storage/client/file/src/test/resources/session-records/getSnapshotMetadataFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/getSnapshotProperties.json b/storage/client/file/src/test/resources/session-records/getSnapshotProperties.json similarity index 100% rename from storage/client/src/test/resources/session-records/getSnapshotProperties.json rename to storage/client/file/src/test/resources/session-records/getSnapshotProperties.json diff --git a/storage/client/src/test/resources/session-records/getSnapshotPropertiesDoesNotExist.json b/storage/client/file/src/test/resources/session-records/getSnapshotPropertiesDoesNotExist.json similarity index 100% rename from storage/client/src/test/resources/session-records/getSnapshotPropertiesDoesNotExist.json rename to storage/client/file/src/test/resources/session-records/getSnapshotPropertiesDoesNotExist.json diff --git a/storage/client/src/test/resources/session-records/getSnapshotPropertiesFromShareClient.json b/storage/client/file/src/test/resources/session-records/getSnapshotPropertiesFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/getSnapshotPropertiesFromShareClient.json rename to storage/client/file/src/test/resources/session-records/getSnapshotPropertiesFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/getStats.json b/storage/client/file/src/test/resources/session-records/getStats.json similarity index 100% rename from storage/client/src/test/resources/session-records/getStats.json rename to storage/client/file/src/test/resources/session-records/getStats.json diff --git a/storage/client/src/test/resources/session-records/getStatsDoesNotExist.json b/storage/client/file/src/test/resources/session-records/getStatsDoesNotExist.json similarity index 100% rename from storage/client/src/test/resources/session-records/getStatsDoesNotExist.json rename to storage/client/file/src/test/resources/session-records/getStatsDoesNotExist.json diff --git a/storage/client/src/test/resources/session-records/getSubDirectoryClient.json b/storage/client/file/src/test/resources/session-records/getSubDirectoryClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/getSubDirectoryClient.json rename to storage/client/file/src/test/resources/session-records/getSubDirectoryClient.json diff --git a/storage/client/src/test/resources/session-records/listFilesAndDirectories.json b/storage/client/file/src/test/resources/session-records/listFilesAndDirectories.json similarity index 100% rename from storage/client/src/test/resources/session-records/listFilesAndDirectories.json rename to storage/client/file/src/test/resources/session-records/listFilesAndDirectories.json diff --git a/storage/client/src/test/resources/session-records/listFilesAndDirectoriesFromDirClient.json b/storage/client/file/src/test/resources/session-records/listFilesAndDirectoriesFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/listFilesAndDirectoriesFromDirClient.json rename to storage/client/file/src/test/resources/session-records/listFilesAndDirectoriesFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/listHandles.json b/storage/client/file/src/test/resources/session-records/listHandles.json similarity index 100% rename from storage/client/src/test/resources/session-records/listHandles.json rename to storage/client/file/src/test/resources/session-records/listHandles.json diff --git a/storage/client/src/test/resources/session-records/listHandlesFromFileClient.json b/storage/client/file/src/test/resources/session-records/listHandlesFromFileClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/listHandlesFromFileClient.json rename to storage/client/file/src/test/resources/session-records/listHandlesFromFileClient.json diff --git a/storage/client/src/test/resources/session-records/listRanges.json b/storage/client/file/src/test/resources/session-records/listRanges.json similarity index 100% rename from storage/client/src/test/resources/session-records/listRanges.json rename to storage/client/file/src/test/resources/session-records/listRanges.json diff --git a/storage/client/src/test/resources/session-records/listRangesFromFileClient.json b/storage/client/file/src/test/resources/session-records/listRangesFromFileClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/listRangesFromFileClient.json rename to storage/client/file/src/test/resources/session-records/listRangesFromFileClient.json diff --git a/storage/client/src/test/resources/session-records/listShares.json b/storage/client/file/src/test/resources/session-records/listShares.json similarity index 100% rename from storage/client/src/test/resources/session-records/listShares.json rename to storage/client/file/src/test/resources/session-records/listShares.json diff --git a/storage/client/src/test/resources/session-records/listSharesIncludeMetadata.json b/storage/client/file/src/test/resources/session-records/listSharesIncludeMetadata.json similarity index 100% rename from storage/client/src/test/resources/session-records/listSharesIncludeMetadata.json rename to storage/client/file/src/test/resources/session-records/listSharesIncludeMetadata.json diff --git a/storage/client/src/test/resources/session-records/listSharesIncludeMetadataAndSnapshots.json b/storage/client/file/src/test/resources/session-records/listSharesIncludeMetadataAndSnapshots.json similarity index 100% rename from storage/client/src/test/resources/session-records/listSharesIncludeMetadataAndSnapshots.json rename to storage/client/file/src/test/resources/session-records/listSharesIncludeMetadataAndSnapshots.json diff --git a/storage/client/src/test/resources/session-records/listSharesIncludeSnapshots.json b/storage/client/file/src/test/resources/session-records/listSharesIncludeSnapshots.json similarity index 100% rename from storage/client/src/test/resources/session-records/listSharesIncludeSnapshots.json rename to storage/client/file/src/test/resources/session-records/listSharesIncludeSnapshots.json diff --git a/storage/client/src/test/resources/session-records/listSharesInvalidMaxResults.json b/storage/client/file/src/test/resources/session-records/listSharesInvalidMaxResults.json similarity index 100% rename from storage/client/src/test/resources/session-records/listSharesInvalidMaxResults.json rename to storage/client/file/src/test/resources/session-records/listSharesInvalidMaxResults.json diff --git a/storage/client/src/test/resources/session-records/listSharesWithLimit.json b/storage/client/file/src/test/resources/session-records/listSharesWithLimit.json similarity index 100% rename from storage/client/src/test/resources/session-records/listSharesWithLimit.json rename to storage/client/file/src/test/resources/session-records/listSharesWithLimit.json diff --git a/storage/client/src/test/resources/session-records/listSharesWithPrefix.json b/storage/client/file/src/test/resources/session-records/listSharesWithPrefix.json similarity index 100% rename from storage/client/src/test/resources/session-records/listSharesWithPrefix.json rename to storage/client/file/src/test/resources/session-records/listSharesWithPrefix.json diff --git a/storage/client/src/test/resources/session-records/setFileServiceProperties.json b/storage/client/file/src/test/resources/session-records/setFileServiceProperties.json similarity index 100% rename from storage/client/src/test/resources/session-records/setFileServiceProperties.json rename to storage/client/file/src/test/resources/session-records/setFileServiceProperties.json diff --git a/storage/client/src/test/resources/session-records/setHttpHeaders.json b/storage/client/file/src/test/resources/session-records/setHttpHeaders.json similarity index 100% rename from storage/client/src/test/resources/session-records/setHttpHeaders.json rename to storage/client/file/src/test/resources/session-records/setHttpHeaders.json diff --git a/storage/client/src/test/resources/session-records/setHttpHeadersFromFileClient.json b/storage/client/file/src/test/resources/session-records/setHttpHeadersFromFileClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/setHttpHeadersFromFileClient.json rename to storage/client/file/src/test/resources/session-records/setHttpHeadersFromFileClient.json diff --git a/storage/client/src/test/resources/session-records/setMeatadata.json b/storage/client/file/src/test/resources/session-records/setMeatadata.json similarity index 100% rename from storage/client/src/test/resources/session-records/setMeatadata.json rename to storage/client/file/src/test/resources/session-records/setMeatadata.json diff --git a/storage/client/src/test/resources/session-records/setMeatadataFromFileClient.json b/storage/client/file/src/test/resources/session-records/setMeatadataFromFileClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/setMeatadataFromFileClient.json rename to storage/client/file/src/test/resources/session-records/setMeatadataFromFileClient.json diff --git a/storage/client/src/test/resources/session-records/setMetadata.json b/storage/client/file/src/test/resources/session-records/setMetadata.json similarity index 100% rename from storage/client/src/test/resources/session-records/setMetadata.json rename to storage/client/file/src/test/resources/session-records/setMetadata.json diff --git a/storage/client/src/test/resources/session-records/setMetadataDoesNotExist.json b/storage/client/file/src/test/resources/session-records/setMetadataDoesNotExist.json similarity index 100% rename from storage/client/src/test/resources/session-records/setMetadataDoesNotExist.json rename to storage/client/file/src/test/resources/session-records/setMetadataDoesNotExist.json diff --git a/storage/client/src/test/resources/session-records/setMetadataDoesNotExistFromShareClient.json b/storage/client/file/src/test/resources/session-records/setMetadataDoesNotExistFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/setMetadataDoesNotExistFromShareClient.json rename to storage/client/file/src/test/resources/session-records/setMetadataDoesNotExistFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/setMetadataFromDirClient.json b/storage/client/file/src/test/resources/session-records/setMetadataFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/setMetadataFromDirClient.json rename to storage/client/file/src/test/resources/session-records/setMetadataFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/setMetadataFromShareClient.json b/storage/client/file/src/test/resources/session-records/setMetadataFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/setMetadataFromShareClient.json rename to storage/client/file/src/test/resources/session-records/setMetadataFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/setMetadataInvalidKeyFromDirClient.json b/storage/client/file/src/test/resources/session-records/setMetadataInvalidKeyFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/setMetadataInvalidKeyFromDirClient.json rename to storage/client/file/src/test/resources/session-records/setMetadataInvalidKeyFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/setMetadataInvalidMetadata.json b/storage/client/file/src/test/resources/session-records/setMetadataInvalidMetadata.json similarity index 100% rename from storage/client/src/test/resources/session-records/setMetadataInvalidMetadata.json rename to storage/client/file/src/test/resources/session-records/setMetadataInvalidMetadata.json diff --git a/storage/client/src/test/resources/session-records/setMetadataInvalidMetadataFromShareClient.json b/storage/client/file/src/test/resources/session-records/setMetadataInvalidMetadataFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/setMetadataInvalidMetadataFromShareClient.json rename to storage/client/file/src/test/resources/session-records/setMetadataInvalidMetadataFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/setMetadataNull.json b/storage/client/file/src/test/resources/session-records/setMetadataNull.json similarity index 100% rename from storage/client/src/test/resources/session-records/setMetadataNull.json rename to storage/client/file/src/test/resources/session-records/setMetadataNull.json diff --git a/storage/client/src/test/resources/session-records/setMetadataNullFromDirClient.json b/storage/client/file/src/test/resources/session-records/setMetadataNullFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/setMetadataNullFromDirClient.json rename to storage/client/file/src/test/resources/session-records/setMetadataNullFromDirClient.json diff --git a/storage/client/src/test/resources/session-records/setPolicies.json b/storage/client/file/src/test/resources/session-records/setPolicies.json similarity index 100% rename from storage/client/src/test/resources/session-records/setPolicies.json rename to storage/client/file/src/test/resources/session-records/setPolicies.json diff --git a/storage/client/src/test/resources/session-records/setPoliciesDoesNotExist.json b/storage/client/file/src/test/resources/session-records/setPoliciesDoesNotExist.json similarity index 100% rename from storage/client/src/test/resources/session-records/setPoliciesDoesNotExist.json rename to storage/client/file/src/test/resources/session-records/setPoliciesDoesNotExist.json diff --git a/storage/client/src/test/resources/session-records/setPoliciesInvalidPermission.json b/storage/client/file/src/test/resources/session-records/setPoliciesInvalidPermission.json similarity index 100% rename from storage/client/src/test/resources/session-records/setPoliciesInvalidPermission.json rename to storage/client/file/src/test/resources/session-records/setPoliciesInvalidPermission.json diff --git a/storage/client/src/test/resources/session-records/setPoliciesTooManyPermissions.json b/storage/client/file/src/test/resources/session-records/setPoliciesTooManyPermissions.json similarity index 100% rename from storage/client/src/test/resources/session-records/setPoliciesTooManyPermissions.json rename to storage/client/file/src/test/resources/session-records/setPoliciesTooManyPermissions.json diff --git a/storage/client/src/test/resources/session-records/setProperties.json b/storage/client/file/src/test/resources/session-records/setProperties.json similarity index 100% rename from storage/client/src/test/resources/session-records/setProperties.json rename to storage/client/file/src/test/resources/session-records/setProperties.json diff --git a/storage/client/src/test/resources/session-records/setPropertiesDoesNotExist.json b/storage/client/file/src/test/resources/session-records/setPropertiesDoesNotExist.json similarity index 100% rename from storage/client/src/test/resources/session-records/setPropertiesDoesNotExist.json rename to storage/client/file/src/test/resources/session-records/setPropertiesDoesNotExist.json diff --git a/storage/client/src/test/resources/session-records/setPropertiesDoesNotExistFromShareClient.json b/storage/client/file/src/test/resources/session-records/setPropertiesDoesNotExistFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/setPropertiesDoesNotExistFromShareClient.json rename to storage/client/file/src/test/resources/session-records/setPropertiesDoesNotExistFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/setPropertiesFromShareClient.json b/storage/client/file/src/test/resources/session-records/setPropertiesFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/setPropertiesFromShareClient.json rename to storage/client/file/src/test/resources/session-records/setPropertiesFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/setPropertiesInvalidAllowedHeader.json b/storage/client/file/src/test/resources/session-records/setPropertiesInvalidAllowedHeader.json similarity index 100% rename from storage/client/src/test/resources/session-records/setPropertiesInvalidAllowedHeader.json rename to storage/client/file/src/test/resources/session-records/setPropertiesInvalidAllowedHeader.json diff --git a/storage/client/src/test/resources/session-records/setPropertiesInvalidAllowedMethod.json b/storage/client/file/src/test/resources/session-records/setPropertiesInvalidAllowedMethod.json similarity index 100% rename from storage/client/src/test/resources/session-records/setPropertiesInvalidAllowedMethod.json rename to storage/client/file/src/test/resources/session-records/setPropertiesInvalidAllowedMethod.json diff --git a/storage/client/src/test/resources/session-records/setPropertiesInvalidAllowedOrigin.json b/storage/client/file/src/test/resources/session-records/setPropertiesInvalidAllowedOrigin.json similarity index 100% rename from storage/client/src/test/resources/session-records/setPropertiesInvalidAllowedOrigin.json rename to storage/client/file/src/test/resources/session-records/setPropertiesInvalidAllowedOrigin.json diff --git a/storage/client/src/test/resources/session-records/setPropertiesInvalidExposedHeader.json b/storage/client/file/src/test/resources/session-records/setPropertiesInvalidExposedHeader.json similarity index 100% rename from storage/client/src/test/resources/session-records/setPropertiesInvalidExposedHeader.json rename to storage/client/file/src/test/resources/session-records/setPropertiesInvalidExposedHeader.json diff --git a/storage/client/src/test/resources/session-records/setPropertiesInvalidQuota.json b/storage/client/file/src/test/resources/session-records/setPropertiesInvalidQuota.json similarity index 100% rename from storage/client/src/test/resources/session-records/setPropertiesInvalidQuota.json rename to storage/client/file/src/test/resources/session-records/setPropertiesInvalidQuota.json diff --git a/storage/client/src/test/resources/session-records/setPropertiesInvalidQuotaFromShareClient.json b/storage/client/file/src/test/resources/session-records/setPropertiesInvalidQuotaFromShareClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/setPropertiesInvalidQuotaFromShareClient.json rename to storage/client/file/src/test/resources/session-records/setPropertiesInvalidQuotaFromShareClient.json diff --git a/storage/client/src/test/resources/session-records/setPropertiesTooManyRules.json b/storage/client/file/src/test/resources/session-records/setPropertiesTooManyRules.json similarity index 100% rename from storage/client/src/test/resources/session-records/setPropertiesTooManyRules.json rename to storage/client/file/src/test/resources/session-records/setPropertiesTooManyRules.json diff --git a/storage/client/src/test/resources/session-records/snapshot.json b/storage/client/file/src/test/resources/session-records/snapshot.json similarity index 100% rename from storage/client/src/test/resources/session-records/snapshot.json rename to storage/client/file/src/test/resources/session-records/snapshot.json diff --git a/storage/client/src/test/resources/session-records/snapshotDifferentMetadata.json b/storage/client/file/src/test/resources/session-records/snapshotDifferentMetadata.json similarity index 100% rename from storage/client/src/test/resources/session-records/snapshotDifferentMetadata.json rename to storage/client/file/src/test/resources/session-records/snapshotDifferentMetadata.json diff --git a/storage/client/src/test/resources/session-records/snapshotDoesNotExist.json b/storage/client/file/src/test/resources/session-records/snapshotDoesNotExist.json similarity index 100% rename from storage/client/src/test/resources/session-records/snapshotDoesNotExist.json rename to storage/client/file/src/test/resources/session-records/snapshotDoesNotExist.json diff --git a/storage/client/src/test/resources/session-records/snapshotSameMetadata.json b/storage/client/file/src/test/resources/session-records/snapshotSameMetadata.json similarity index 100% rename from storage/client/src/test/resources/session-records/snapshotSameMetadata.json rename to storage/client/file/src/test/resources/session-records/snapshotSameMetadata.json diff --git a/storage/client/src/test/resources/session-records/startCopy.json b/storage/client/file/src/test/resources/session-records/startCopy.json similarity index 100% rename from storage/client/src/test/resources/session-records/startCopy.json rename to storage/client/file/src/test/resources/session-records/startCopy.json diff --git a/storage/client/src/test/resources/session-records/upload.json b/storage/client/file/src/test/resources/session-records/upload.json similarity index 100% rename from storage/client/src/test/resources/session-records/upload.json rename to storage/client/file/src/test/resources/session-records/upload.json diff --git a/storage/client/src/test/resources/session-records/uploadAndDownloadLargeFile.json b/storage/client/file/src/test/resources/session-records/uploadAndDownloadLargeFile.json similarity index 100% rename from storage/client/src/test/resources/session-records/uploadAndDownloadLargeFile.json rename to storage/client/file/src/test/resources/session-records/uploadAndDownloadLargeFile.json diff --git a/storage/client/src/test/resources/session-records/uploadLargeFile.json b/storage/client/file/src/test/resources/session-records/uploadLargeFile.json similarity index 100% rename from storage/client/src/test/resources/session-records/uploadLargeFile.json rename to storage/client/file/src/test/resources/session-records/uploadLargeFile.json diff --git a/storage/client/src/test/resources/session-records/url.json b/storage/client/file/src/test/resources/session-records/url.json similarity index 100% rename from storage/client/src/test/resources/session-records/url.json rename to storage/client/file/src/test/resources/session-records/url.json diff --git a/storage/client/src/test/resources/session-records/urlFromDirClient.json b/storage/client/file/src/test/resources/session-records/urlFromDirClient.json similarity index 100% rename from storage/client/src/test/resources/session-records/urlFromDirClient.json rename to storage/client/file/src/test/resources/session-records/urlFromDirClient.json diff --git a/storage/client/src/test/resources/testfiles/helloworld b/storage/client/file/src/test/resources/testfiles/helloworld similarity index 100% rename from storage/client/src/test/resources/testfiles/helloworld rename to storage/client/file/src/test/resources/testfiles/helloworld diff --git a/storage/client/src/test/resources/testfiles/uploadSample.txt b/storage/client/file/src/test/resources/testfiles/uploadSample.txt similarity index 100% rename from storage/client/src/test/resources/testfiles/uploadSample.txt rename to storage/client/file/src/test/resources/testfiles/uploadSample.txt diff --git a/storage/client/src/main/java/com/azure/storage/blob/AccountSASPermission.java b/storage/client/src/main/java/com/azure/storage/blob/AccountSASPermission.java deleted file mode 100644 index 2e909098792d6..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/AccountSASPermission.java +++ /dev/null @@ -1,252 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import java.util.Locale; - -/** - * This is a helper class to construct a string representing the permissions granted by an AccountSAS. Setting a value - * to true means that any SAS which uses these permissions will grant permissions for that operation. Once all the - * values are set, this should be serialized with toString and set as the permissions field on an - * {@link AccountSASSignatureValues} object. It is possible to construct the permissions string without this class, but - * the order of the permissions is particular and this class guarantees correctness. - */ -final class AccountSASPermission { - - private boolean read; - - private boolean add; - - private boolean create; - - private boolean write; - - private boolean delete; - - private boolean list; - - private boolean update; - - private boolean processMessages; - - /** - * Initializes an {@code AccountSASPermission} object with all fields set to false. - */ - public AccountSASPermission() { - } - - /** - * Creates an {@code AccountSASPermission} from the specified permissions string. This method will throw an - * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. - * - * @param permString - * A {@code String} which represents the {@code SharedAccessAccountPermissions}. - * - * @return An {@code AccountSASPermission} object generated from the given {@code String}. - */ - public static AccountSASPermission parse(String permString) { - AccountSASPermission permissions = new AccountSASPermission(); - - for (int i = 0; i < permString.length(); i++) { - char c = permString.charAt(i); - switch (c) { - case 'r': - permissions.read = true; - break; - case 'w': - permissions.write = true; - break; - case 'd': - permissions.delete = true; - break; - case 'l': - permissions.list = true; - break; - case 'a': - permissions.add = true; - break; - case 'c': - permissions.create = true; - break; - case 'u': - permissions.update = true; - break; - case 'p': - permissions.processMessages = true; - break; - default: - throw new IllegalArgumentException( - String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, "Permissions", permString, c)); - } - } - return permissions; - } - - /** - * Permission to read resources and list queues and tables granted. - */ - public boolean read() { - return read; - } - - /** - * Permission to read resources and list queues and tables granted. - */ - public AccountSASPermission withRead(boolean read) { - this.read = read; - return this; - } - - /** - * Permission to add messages, table entities, and append to blobs granted. - */ - public boolean add() { - return add; - } - - /** - * Permission to add messages, table entities, and append to blobs granted. - */ - public AccountSASPermission withAdd(boolean add) { - this.add = add; - return this; - } - - /** - * Permission to create blobs and files granted. - */ - public boolean create() { - return create; - } - - /** - * Permission to create blobs and files granted. - */ - public AccountSASPermission withCreate(boolean create) { - this.create = create; - return this; - } - - /** - * Permission to write resources granted. - */ - public boolean write() { - return write; - } - - /** - * Permission to write resources granted. - */ - public AccountSASPermission withWrite(boolean write) { - this.write = write; - return this; - } - - /** - * Permission to delete resources granted. - */ - public boolean delete() { - return delete; - } - - /** - * Permission to delete resources granted. - */ - public AccountSASPermission withDelete(boolean delete) { - this.delete = delete; - return this; - } - - /** - * Permission to list blob containers, blobs, shares, directories, and files granted. - */ - public boolean list() { - return list; - } - - /** - * Permission to list blob containers, blobs, shares, directories, and files granted. - */ - public AccountSASPermission withList(boolean list) { - this.list = list; - return this; - } - - /** - * Permissions to update messages and table entities granted. - */ - public boolean update() { - return update; - } - - /** - * Permissions to update messages and table entities granted. - */ - public AccountSASPermission withUpdate(boolean update) { - this.update = update; - return this; - } - - /** - * Permission to get and delete messages granted. - */ - public boolean processMessages() { - return processMessages; - } - - /** - * Permission to get and delete messages granted. - */ - public AccountSASPermission withProcessMessages(boolean processMessages) { - this.processMessages = processMessages; - return this; - } - - /** - * Converts the given permissions to a {@code String}. Using this method will guarantee the permissions are in an - * order accepted by the service. - * - * @return A {@code String} which represents the {@code AccountSASPermissions}. - */ - @Override - public String toString() { - // The order of the characters should be as specified here to ensure correctness: - // https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas - final StringBuilder builder = new StringBuilder(); - - if (this.read) { - builder.append('r'); - } - - if (this.write) { - builder.append('w'); - } - - if (this.delete) { - builder.append('d'); - } - - if (this.list) { - builder.append('l'); - } - - if (this.add) { - builder.append('a'); - } - - if (this.create) { - builder.append('c'); - } - - if (this.update) { - builder.append('u'); - } - - if (this.processMessages) { - builder.append('p'); - } - - return builder.toString(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/AccountSASResourceType.java b/storage/client/src/main/java/com/azure/storage/blob/AccountSASResourceType.java deleted file mode 100644 index a7d6c477e22c8..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/AccountSASResourceType.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import java.util.Locale; - -/** - * This is a helper class to construct a string representing the resources accessible by an AccountSAS. Setting a value - * to true means that any SAS which uses these permissions will grant access to that resource type. Once all the - * values are set, this should be serialized with toString and set as the resources field on an - * {@link AccountSASSignatureValues} object. It is possible to construct the resources string without this class, but - * the order of the resources is particular and this class guarantees correctness. - */ -final class AccountSASResourceType { - - private boolean service; - - private boolean container; - - private boolean object; - - /** - * Initializes an {@code AccountSASResourceType} object with all fields set to false. - */ - public AccountSASResourceType() { - } - - /** - * Creates an {@code AccountSASResourceType} from the specified resource types string. This method will throw an - * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid resource type. - * - * @param resourceTypesString - * A {@code String} which represents the {@code AccountSASResourceTypes}. - * - * @return A {@code AccountSASResourceType} generated from the given {@code String}. - */ - public static AccountSASResourceType parse(String resourceTypesString) { - AccountSASResourceType resourceType = new AccountSASResourceType(); - - for (int i = 0; i < resourceTypesString.length(); i++) { - char c = resourceTypesString.charAt(i); - switch (c) { - case 's': - resourceType.service = true; - break; - case 'c': - resourceType.container = true; - break; - case 'o': - resourceType.object = true; - break; - default: - throw new IllegalArgumentException( - String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, - "Resource Types", resourceTypesString, c)); - } - } - return resourceType; - } - - /** - * Permission to access service level APIs granted. - */ - public boolean service() { - return service; - } - - /** - * Permission to access service level APIs granted. - */ - public AccountSASResourceType withService(boolean service) { - this.service = service; - return this; - } - - /** - * Permission to access container level APIs (Blob Containers, Tables, Queues, File Shares) granted. - */ - public boolean container() { - return container; - } - - /** - * Permission to access container level APIs (Blob Containers, Tables, Queues, File Shares) granted. - */ - public AccountSASResourceType withContainer(boolean container) { - this.container = container; - return this; - } - - /** - * Permission to access object level APIs (Blobs, Table Entities, Queue Messages, Files) granted. - */ - public boolean object() { - return object; - } - - /** - * Permission to access object level APIs (Blobs, Table Entities, Queue Messages, Files) granted. - */ - public AccountSASResourceType withObject(boolean object) { - this.object = object; - return this; - } - - /** - * Converts the given resource types to a {@code String}. Using this method will guarantee the resource types are in - * an order accepted by the service. - * - * @return A {@code String} which represents the {@code AccountSASResourceTypes}. - */ - @Override - public String toString() { - // The order of the characters should be as specified here to ensure correctness: - // https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas - StringBuilder builder = new StringBuilder(); - - if (this.service) { - builder.append('s'); - } - - if (this.container) { - builder.append('c'); - } - - if (this.object) { - builder.append('o'); - } - - return builder.toString(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/AccountSASService.java b/storage/client/src/main/java/com/azure/storage/blob/AccountSASService.java deleted file mode 100644 index 1ba5564c542ce..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/AccountSASService.java +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import java.util.Locale; - -/** - * This is a helper class to construct a string representing the services accessible by an AccountSAS. Setting a value - * to true means that any SAS which uses these permissions will grant access to that service. Once all the - * values are set, this should be serialized with toString and set as the services field on an - * {@link AccountSASSignatureValues} object. It is possible to construct the services string without this class, but - * the order of the services is particular and this class guarantees correctness. - */ -final class AccountSASService { - - private boolean blob; - - private boolean file; - - private boolean queue; - - private boolean table; - - /** - * Initializes an {@code AccountSASService} object with all fields set to false. - */ - public AccountSASService() { - } - - /** - * Creates an {@code AccountSASService} from the specified services string. This method will throw an - * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid service. - * - * @param servicesString - * A {@code String} which represents the {@code SharedAccessAccountServices}. - * - * @return A {@code AccountSASService} generated from the given {@code String}. - */ - public static AccountSASService parse(String servicesString) { - AccountSASService services = new AccountSASService(); - - for (int i = 0; i < servicesString.length(); i++) { - char c = servicesString.charAt(i); - switch (c) { - case 'b': - services.blob = true; - break; - case 'f': - services.file = true; - break; - case 'q': - services.queue = true; - break; - case 't': - services.table = true; - break; - default: - throw new IllegalArgumentException( - String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, "Services", - servicesString, c)); - } - } - return services; - } - - /** - * Permission to access blob resources granted. - */ - public boolean blob() { - return blob; - } - - /** - * Permission to access blob resources granted. - */ - public AccountSASService withBlob(boolean blob) { - this.blob = blob; - return this; - } - - /** - * Permission to access file resources granted. - */ - public boolean file() { - return file; - } - - /** - * Permission to access file resources granted. - */ - public AccountSASService withFile(boolean file) { - this.file = file; - return this; - } - - /** - * Permission to access queue resources granted. - */ - public boolean queue() { - return queue; - } - - /** - * Permission to access queue resources granted. - */ - public AccountSASService withQueue(boolean queue) { - this.queue = queue; - return this; - } - - /** - * Permission to access table resources granted. - */ - public boolean table() { - return table; - } - - /** - * Permission to access table resources granted. - */ - public AccountSASService withTable(boolean table) { - this.table = table; - return this; - } - - /** - * Converts the given services to a {@code String}. Using this method will guarantee the services are in an order - * accepted by the service. - * - * @return A {@code String} which represents the {@code AccountSASServices}. - */ - @Override - public String toString() { - // The order of the characters should be as specified here to ensure correctness: - // https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-an-account-sas - StringBuilder value = new StringBuilder(); - - if (this.blob) { - value.append('b'); - } - if (this.queue) { - value.append('q'); - } - if (this.table) { - value.append('t'); - } - if (this.file) { - value.append('f'); - } - - return value.toString(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/AccountSASSignatureValues.java b/storage/client/src/main/java/com/azure/storage/blob/AccountSASSignatureValues.java deleted file mode 100644 index c14d218574a01..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/AccountSASSignatureValues.java +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import java.security.InvalidKeyException; -import java.time.OffsetDateTime; - -/** - * AccountSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage account. Once - * all the values here are set appropriately, call generateSASQueryParameters to obtain a representation of the SAS - * which can actually be applied to blob urls. Note: that both this class and {@link SASQueryParameters} exist because - * the former is mutable and a logical representation while the latter is immutable and used to generate actual REST - * requests. - *

- * Please see - * here - * for more conceptual information on SAS: - *

- *

- * Please see - * here for further - * descriptions of the parameters, including which are required: - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=account_sas "Sample code for AccountSASSignatureValues")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ -final class AccountSASSignatureValues { - - private String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION; - - private SASProtocol protocol; - - private OffsetDateTime startTime; - - private OffsetDateTime expiryTime; - - private String permissions; - - private IPRange ipRange; - - private String services; - - private String resourceTypes; - - /** - * Initializes an {@code AccountSASSignatureValues} object with the version number set to the default and all - * other values empty. - */ - public AccountSASSignatureValues() { - } - - /** - * If null or empty, this defaults to the service version targeted by this version of the library. - */ - public String version() { - return version; - } - - /** - * If null or empty, this defaults to the service version targeted by this version of the library. - */ - public AccountSASSignatureValues withVersion(String version) { - this.version = version; - return this; - } - - /** - * {@link SASProtocol} - */ - public SASProtocol protocol() { - return protocol; - } - - /** - * {@link SASProtocol} - */ - public AccountSASSignatureValues withProtocol(SASProtocol protocol) { - this.protocol = protocol; - return this; - } - - /** - * When the SAS will take effect. - */ - public OffsetDateTime startTime() { - return startTime; - } - - /** - * When the SAS will take effect. - */ - public AccountSASSignatureValues withStartTime(OffsetDateTime startTime) { - this.startTime = startTime; - return this; - } - - /** - * The time after which the SAS will no longer work. - */ - public OffsetDateTime expiryTime() { - return expiryTime; - } - - /** - * The time after which the SAS will no longer work. - */ - public AccountSASSignatureValues withExpiryTime(OffsetDateTime expiryTime) { - this.expiryTime = expiryTime; - return this; - } - - /** - * Specifies which operations the SAS user may perform. Please refer to {@link AccountSASPermission} for help - * constructing the permissions string. - */ - public String permissions() { - return permissions; - } - - /** - * Specifies which operations the SAS user may perform. Please refer to {@link AccountSASPermission} for help - * constructing the permissions string. - */ - public AccountSASSignatureValues withPermissions(String permissions) { - this.permissions = permissions; - return this; - } - - /** - * {@link IPRange} - */ - public IPRange ipRange() { - return ipRange; - } - - /** - * {@link IPRange} - */ - public AccountSASSignatureValues withIpRange(IPRange ipRange) { - this.ipRange = ipRange; - return this; - } - - /** - * The values that indicate the services accessible with this SAS. Please refer to {@link AccountSASService} to - * construct this value. - */ - public String services() { - return services; - } - - /** - * The values that indicate the services accessible with this SAS. Please refer to {@link AccountSASService} to - * construct this value. - */ - public AccountSASSignatureValues withServices(String services) { - this.services = services; - return this; - } - - /** - * The values that indicate the resource types accessible with this SAS. Please refer - * to {@link AccountSASResourceType} to construct this value. - */ - public String resourceTypes() { - return resourceTypes; - } - - /** - * The values that indicate the resource types accessible with this SAS. Please refer - * to {@link AccountSASResourceType} to construct this value. - */ - public AccountSASSignatureValues withResourceTypes(String resourceTypes) { - this.resourceTypes = resourceTypes; - return this; - } - - /** - * Generates a {@link SASQueryParameters} object which contains all SAS query parameters needed to make an actual - * REST request. - * - * @param sharedKeyCredentials - * Credentials for the storage account and corresponding primary or secondary key. - * - * @return {@link SASQueryParameters} - */ - public SASQueryParameters generateSASQueryParameters(SharedKeyCredentials sharedKeyCredentials) { - Utility.assertNotNull("SharedKeyCredentials", sharedKeyCredentials); - Utility.assertNotNull("services", this.services); - Utility.assertNotNull("resourceTypes", this.resourceTypes); - Utility.assertNotNull("expiryTime", this.expiryTime); - Utility.assertNotNull("permissions", this.permissions); - Utility.assertNotNull("version", this.version); - - // Signature is generated on the un-url-encoded values. - final String stringToSign = stringToSign(sharedKeyCredentials); - - String signature; - try { - signature = sharedKeyCredentials.computeHmac256(stringToSign); - } catch (InvalidKeyException e) { - throw new Error(e); // The key should have been validated by now. If it is no longer valid here, we fail. - } - - return new SASQueryParameters(this.version, this.services, resourceTypes, - this.protocol, this.startTime, this.expiryTime, this.ipRange, null, - null, this.permissions, signature, null, null, null, null, null, null); - } - - private String stringToSign(final SharedKeyCredentials sharedKeyCredentials) { - return String.join("\n", - sharedKeyCredentials.getAccountName(), - AccountSASPermission.parse(this.permissions).toString(), // guarantees ordering - this.services, - resourceTypes, - this.startTime == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.startTime), - Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.expiryTime), - this.ipRange == null ? (new IPRange()).toString() : this.ipRange.toString(), - this.protocol == null ? "" : this.protocol.toString(), - this.version, - Constants.EMPTY_STRING // Account SAS requires an additional newline character - ); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/AnonymousCredentials.java b/storage/client/src/main/java/com/azure/storage/blob/AnonymousCredentials.java deleted file mode 100644 index 923b1c941dd9f..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/AnonymousCredentials.java +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipelineCallContext; -import com.azure.core.http.HttpPipelineNextPolicy; -import com.azure.core.http.HttpResponse; -import reactor.core.publisher.Mono; - -/** - * Anonymous credentials are to be used with with HTTP(S) requests that read blobs from public containers or requests - * that use a Shared Access Signature (SAS). This is because Anonymous credentials will not set an Authorization header. - * Pass an instance of this class as the credentials parameter when creating a new pipeline (typically with - * {@link StorageURL}). - */ -public final class AnonymousCredentials implements ICredentials { - - /** - * Returns an empty instance of {@code AnonymousCredentials}. - */ - public AnonymousCredentials() { - } - - - - @Override - public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - return next.process(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/AppendBlobAccessConditions.java b/storage/client/src/main/java/com/azure/storage/blob/AppendBlobAccessConditions.java deleted file mode 100644 index 2d137418118e6..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/AppendBlobAccessConditions.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.storage.blob.models.AppendPositionAccessConditions; -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.ModifiedAccessConditions; - -/** - * This class contains values that restrict the successful completion of AppendBlock operations to certain conditions. - * Any field may be set to null if no access conditions are desired. - *

- * Please refer to the request header section - * here for more conceptual - * information. - */ -public final class AppendBlobAccessConditions { - - private AppendPositionAccessConditions appendPositionAccessConditions; - - private ModifiedAccessConditions modifiedAccessConditions; - - private LeaseAccessConditions leaseAccessConditions; - - /** - * Creates an instance which has fields set to non-null, empty values. - */ - public AppendBlobAccessConditions() { - appendPositionAccessConditions = new AppendPositionAccessConditions(); - modifiedAccessConditions = new ModifiedAccessConditions(); - leaseAccessConditions = new LeaseAccessConditions(); - } - - /** - * Access conditions used for appending data only if the operation meets the provided conditions related to the - * size of the append blob. - */ - public AppendPositionAccessConditions appendPositionAccessConditions() { - return appendPositionAccessConditions; - } - - /** - * Access conditions used for appending data only if the operation meets the provided conditions related to the - * size of the append blob. - */ - public AppendBlobAccessConditions withAppendPositionAccessConditions( - AppendPositionAccessConditions appendPositionAccessConditions) { - this.appendPositionAccessConditions = appendPositionAccessConditions; - return this; - } - - /** - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used to - * construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - */ - public ModifiedAccessConditions modifiedAccessConditions() { - return modifiedAccessConditions; - } - - /** - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used to - * construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - */ - public AppendBlobAccessConditions withModifiedAccessConditions(ModifiedAccessConditions modifiedAccessConditions) { - this.modifiedAccessConditions = modifiedAccessConditions; - return this; - } - - /** - * By setting lease access conditions, requests will fail if the provided lease does not match the active lease on - * the blob. - */ - public LeaseAccessConditions leaseAccessConditions() { - return leaseAccessConditions; - } - - /** - * By setting lease access conditions, requests will fail if the provided lease does not match the active lease on - * the blob. - */ - public AppendBlobAccessConditions withLeaseAccessConditions(LeaseAccessConditions leaseAccessConditions) { - this.leaseAccessConditions = leaseAccessConditions; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java b/storage/client/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java deleted file mode 100644 index 73607c2ed3f26..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/AppendBlobAsyncClient.java +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.rest.ResponseBase; -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.AppendBlobAppendBlockFromUrlHeaders; -import com.azure.storage.blob.models.AppendBlobAppendBlockHeaders; -import com.azure.storage.blob.models.AppendBlobCreateHeaders; -import com.azure.storage.blob.models.BlobHTTPHeaders; -import com.azure.storage.blob.models.SourceModifiedAccessConditions; -import io.netty.buffer.ByteBuf; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.net.URL; - - -/** - * Client to an append blob. It may only be instantiated through a {@link AppendBlobClientBuilder}, via - * the method {@link BlobAsyncClient#asAppendBlobAsyncClient()}, or via the method - * {@link ContainerAsyncClient#getAppendBlobAsyncClient(String)}. This class does not hold - * any state about a particular blob, but is instead a convenient way of sending appropriate - * requests to the resource on the service. - * - *

- * This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient}, - * and operations on the service are available on {@link StorageAsyncClient}. - * - *

- * Please refer - * to the Azure Docs - * for more information. - * - *

- * Note this client is an async client that returns reactive responses from Spring Reactor Core - * project (https://projectreactor.io/). Calling the methods in this client will NOT - * start the actual network operation, until {@code .subscribe()} is called on the reactive response. - * You can simply convert one of these responses to a {@link java.util.concurrent.CompletableFuture} - * object through {@link Mono#toFuture()}. - */ -public final class AppendBlobAsyncClient extends BlobAsyncClient { - AppendBlobAsyncRawClient appendBlobAsyncRawClient; - - /** - * Indicates the maximum number of bytes that can be sent in a call to appendBlock. - */ - public static final int MAX_APPEND_BLOCK_BYTES = 4 * Constants.MB; - - /** - * Indicates the maximum number of blocks allowed in an append blob. - */ - public static final int MAX_BLOCKS = 50000; - - /** - * Package-private constructor for use by {@link AppendBlobClientBuilder}. - * @param azureBlobStorage the API client for blob storage API - */ - AppendBlobAsyncClient(AzureBlobStorageImpl azureBlobStorage) { - super(azureBlobStorage); - appendBlobAsyncRawClient = new AppendBlobAsyncRawClient(azureBlobStorage); - } - - /** - * Static method for getting a new builder for this class. - * - * @return - * A new {@link AppendBlobClientBuilder} instance. - */ - public static AppendBlobClientBuilder appendBlobClientBuilder() { - return new AppendBlobClientBuilder(); - } - - /** - * Creates a 0-length append blob. Call appendBlock to append data to an append blob. - * - * @return - * A reactive response containing the information of the created appended blob. - */ - public Mono create() { - return this.create(null, null, null, null); - } - - /** - * Creates a 0-length append blob. Call appendBlock to append data to an append blob. - * - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the information of the created appended blob. - */ - public Mono create(BlobHTTPHeaders headers, Metadata metadata, - BlobAccessConditions accessConditions, Context context) { - return appendBlobAsyncRawClient - .create(headers, metadata, accessConditions, context) - .map(ResponseBase::deserializedHeaders); - } - - /** - * Commits a new block of data to the end of the existing append blob. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flux must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * - * @return - * A reactive response containing the information of the append blob operation. - */ - public Mono appendBlock(Flux data, long length) { - return this.appendBlock(data, length, null, null); - } - - /** - * Commits a new block of data to the end of the existing append blob. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flux must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * @param appendBlobAccessConditions - * {@link AppendBlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the information of the append blob operation. - */ - public Mono appendBlock(Flux data, long length, - AppendBlobAccessConditions appendBlobAccessConditions, Context context) { - return appendBlobAsyncRawClient - .appendBlock(data, length, appendBlobAccessConditions, context) - .map(ResponseBase::deserializedHeaders); - } - - /** - * Commits a new block of data from another blob to the end of this append blob. - * - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange - * The source {@link BlobRange} to copy. - * - * @return - * A reactive response containing the information of the append blob operation. - */ - public Mono appendBlockFromUrl(URL sourceURL, BlobRange sourceRange) { - return this.appendBlockFromUrl(sourceURL, sourceRange, null, null, - null, null); - } - - /** - * Commits a new block of data from another blob to the end of this append blob. - * - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param destAccessConditions - * {@link AppendBlobAccessConditions} - * @param sourceAccessConditions - * {@link SourceModifiedAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the information of the append blob operation. - */ - public Mono appendBlockFromUrl(URL sourceURL, BlobRange sourceRange, - byte[] sourceContentMD5, AppendBlobAccessConditions destAccessConditions, - SourceModifiedAccessConditions sourceAccessConditions, Context context) { - return appendBlobAsyncRawClient - .appendBlockFromUrl(sourceURL, sourceRange, sourceContentMD5, destAccessConditions, sourceAccessConditions, context) - .map(ResponseBase::deserializedHeaders); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/AppendBlobAsyncRawClient.java b/storage/client/src/main/java/com/azure/storage/blob/AppendBlobAsyncRawClient.java deleted file mode 100644 index 17fc536b9873f..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/AppendBlobAsyncRawClient.java +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.AppendBlobsAppendBlockFromUrlResponse; -import com.azure.storage.blob.models.AppendBlobsAppendBlockResponse; -import com.azure.storage.blob.models.AppendBlobsCreateResponse; -import com.azure.storage.blob.models.BlobHTTPHeaders; -import com.azure.storage.blob.models.SourceModifiedAccessConditions; -import io.netty.buffer.ByteBuf; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.net.URL; - -import static com.azure.storage.blob.Utility.postProcessResponse; - - -/** - * Represents a URL to an append blob. It may be obtained by direct construction or via the create method on a - * {@link ContainerAsyncClient} object. This class does not hold any state about a particular append blob but is instead a - * convenient way of sending off appropriate requests to the resource on the service. Please refer to the - * Azure Docs - */ -final class AppendBlobAsyncRawClient extends BlobAsyncRawClient { - - /** - * Indicates the maximum number of bytes that can be sent in a call to appendBlock. - */ - public static final int MAX_APPEND_BLOCK_BYTES = 4 * Constants.MB; - - /** - * Indicates the maximum number of blocks allowed in an append blob. - */ - public static final int MAX_BLOCKS = 50000; - - /** - * Creates a {@code AppendBlobAsyncRawClient} object pointing to the account specified by the URL and using the provided - * pipeline to make HTTP requests. - */ - AppendBlobAsyncRawClient(AzureBlobStorageImpl azureBlobStorage) { - super(azureBlobStorage); - } - - /** - * Creates a 0-length append blob. Call AppendBlock to append data to an append blob. For more information, see - * the Azure Docs. - * - * @return Emits the successful response. - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=append_blob "Sample code for AppendBlobAsyncRawClient.create")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono create() { - return this.create(null, null, null, null); - } - - /** - * Creates a 0-length append blob. Call AppendBlock to append data to an append blob. For more information, see - * the Azure Docs. - * - * @param headers {@link BlobHTTPHeaders} - * @param metadata {@link Metadata} - * @param accessConditions {@link BlobAccessConditions} - * @param context {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * @return Emits the successful response. - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=append_blob "Sample code for AppendBlobAsyncRawClient.create")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono create(BlobHTTPHeaders headers, Metadata metadata, - BlobAccessConditions accessConditions, Context context) { - metadata = metadata == null ? new Metadata() : metadata; - accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.appendBlobs().createWithRestResponseAsync(null, - null, 0, null, metadata, null, null, - null, null, headers, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), context)); - } - - /** - * Commits a new block of data to the end of the existing append blob. For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param data The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * @param length The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * @return Emits the successful response. - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=append_blob "Sample code for AppendBlobAsyncRawClient.appendBlock")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono appendBlock(Flux data, long length) { - return this.appendBlock(data, length, null, null); - } - - /** - * Commits a new block of data to the end of the existing append blob. For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param data The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * @param length The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * @param appendBlobAccessConditions {@link AppendBlobAccessConditions} - * @param context {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * @return Emits the successful response. - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=append_blob "Sample code for AppendBlobAsyncRawClient.appendBlock")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono appendBlock(Flux data, long length, - AppendBlobAccessConditions appendBlobAccessConditions, Context context) { - appendBlobAccessConditions = appendBlobAccessConditions == null ? new AppendBlobAccessConditions() - : appendBlobAccessConditions; - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.appendBlobs().appendBlockWithRestResponseAsync( - null, null, data, length, null, null, - null, null, null, null, - appendBlobAccessConditions.leaseAccessConditions(), - appendBlobAccessConditions.appendPositionAccessConditions(), - appendBlobAccessConditions.modifiedAccessConditions(), context)); - } - - /** - * Commits a new block of data from another blob to the end of this append blob. For more information, see the - * Azure Docs. - *

- * - * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange The source {@link BlobRange} to copy. - * @return Emits the successful response. - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=append_from_url "Sample code for AppendBlobAsyncRawClient.appendBlockFromUrl")] - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono appendBlockFromUrl(URL sourceURL, BlobRange sourceRange) { - return this.appendBlockFromUrl(sourceURL, sourceRange, null, null, - null, null); - } - - /** - * Commits a new block of data from another blob to the end of this append blob. For more information, see the - * Azure Docs. - *

- * - * @param sourceURL The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange {@link BlobRange} - * @param sourceContentMD5 An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param destAccessConditions {@link AppendBlobAccessConditions} - * @param sourceAccessConditions {@link SourceModifiedAccessConditions} - * @param context {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * @return Emits the successful response. - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=append_from_url "Sample code for AppendBlobAsyncRawClient.appendBlockFromUrl")] - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono appendBlockFromUrl(URL sourceURL, BlobRange sourceRange, - byte[] sourceContentMD5, AppendBlobAccessConditions destAccessConditions, - SourceModifiedAccessConditions sourceAccessConditions, Context context) { - - sourceRange = sourceRange == null ? new BlobRange(0) : sourceRange; - destAccessConditions = destAccessConditions == null - ? new AppendBlobAccessConditions() : destAccessConditions; - context = context == null ? Context.NONE : context; - - return postProcessResponse( - this.azureBlobStorage.appendBlobs().appendBlockFromUrlWithRestResponseAsync(null, null, - sourceURL, 0, sourceRange.toString(), sourceContentMD5, null, null, - destAccessConditions.leaseAccessConditions(), - destAccessConditions.appendPositionAccessConditions(), - destAccessConditions.modifiedAccessConditions(), sourceAccessConditions, context)); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/AppendBlobClient.java b/storage/client/src/main/java/com/azure/storage/blob/AppendBlobClient.java deleted file mode 100644 index 97bc08151b3b1..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/AppendBlobClient.java +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.AppendBlobAppendBlockFromUrlHeaders; -import com.azure.storage.blob.models.AppendBlobAppendBlockHeaders; -import com.azure.storage.blob.models.AppendBlobCreateHeaders; -import com.azure.storage.blob.models.BlobHTTPHeaders; -import com.azure.storage.blob.models.SourceModifiedAccessConditions; -import io.netty.buffer.ByteBuf; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.net.URL; -import java.time.Duration; - - -/** - * Client to an append blob. It may only be instantiated through a {@link AppendBlobClientBuilder}, via - * the method {@link BlobClient#asAppendBlobClient()}, or via the method - * {@link ContainerClient#getAppendBlobClient(String)}. This class does not hold - * any state about a particular blob, but is instead a convenient way of sending appropriate - * requests to the resource on the service. - * - *

- * This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, - * and operations on the service are available on {@link StorageClient}. - * - *

- * Please refer to the Azure Docs - * for more information. - */ -public final class AppendBlobClient extends BlobClient { - - AppendBlobAsyncClient appendBlobAsyncClient; - - /** - * Indicates the maximum number of bytes that can be sent in a call to appendBlock. - */ - public static final int MAX_APPEND_BLOCK_BYTES = 4 * Constants.MB; - - /** - * Indicates the maximum number of blocks allowed in an append blob. - */ - public static final int MAX_BLOCKS = 50000; - - /** - * Package-private constructor for use by {@link AppendBlobClientBuilder}. - * @param azureBlobStorage the API client for blob storage API - */ - AppendBlobClient(AzureBlobStorageImpl azureBlobStorage) { - super(azureBlobStorage); - this.appendBlobAsyncClient = new AppendBlobAsyncClient(azureBlobStorage); - } - - /** - * Static method for getting a new builder for this class. - * - * @return - * A new {@link AppendBlobClientBuilder} instance. - */ - public static AppendBlobClientBuilder appendBlobClientBuilder() { - return new AppendBlobClientBuilder(); - } - - /** - * Creates a 0-length append blob. Call appendBlock to append data to an append blob. - * - * @return - * The information of the created appended blob. - */ - public AppendBlobCreateHeaders create() { - return this.create(null, null, null, null, null); - } - - /** - * Creates a 0-length append blob. Call appendBlock to append data to an append blob. - * - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * The information of the created appended blob. - */ - public AppendBlobCreateHeaders create(BlobHTTPHeaders headers, Metadata metadata, - BlobAccessConditions accessConditions, Duration timeout, Context context) { - Mono response = appendBlobAsyncClient.create(headers, metadata, accessConditions, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Commits a new block of data to the end of the existing append blob. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flux must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * - * @return - * The information of the append blob operation. - */ - public AppendBlobAppendBlockHeaders appendBlock(Flux data, long length) { - return this.appendBlock(data, length, null, null, null); - } - - /** - * Commits a new block of data to the end of the existing append blob. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flux must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * @param appendBlobAccessConditions - * {@link AppendBlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * The information of the append blob operation. - */ - public AppendBlobAppendBlockHeaders appendBlock(Flux data, long length, - AppendBlobAccessConditions appendBlobAccessConditions, Duration timeout, Context context) { - Mono response = appendBlobAsyncClient.appendBlock(data, length, appendBlobAccessConditions, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Commits a new block of data from another blob to the end of this append blob. - * - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange - * The source {@link BlobRange} to copy. - * - * @return - * The information of the append blob operation. - */ - public AppendBlobAppendBlockFromUrlHeaders appendBlockFromUrl(URL sourceURL, BlobRange sourceRange) { - return this.appendBlockFromUrl(sourceURL, sourceRange, null, null, - null, null, null); - } - - /** - * Commits a new block of data from another blob to the end of this append blob. - * - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param destAccessConditions - * {@link AppendBlobAccessConditions} - * @param sourceAccessConditions - * {@link SourceModifiedAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * The information of the append blob operation. - */ - public AppendBlobAppendBlockFromUrlHeaders appendBlockFromUrl(URL sourceURL, BlobRange sourceRange, - byte[] sourceContentMD5, AppendBlobAccessConditions destAccessConditions, - SourceModifiedAccessConditions sourceAccessConditions, Duration timeout, Context context) { - Mono response = appendBlobAsyncClient.appendBlockFromUrl(sourceURL, sourceRange, sourceContentMD5, destAccessConditions, sourceAccessConditions, context); - return timeout == null - ? response.block() - : response.block(timeout); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/AppendBlobClientBuilder.java b/storage/client/src/main/java/com/azure/storage/blob/AppendBlobClientBuilder.java deleted file mode 100644 index f1a81a07f2ddb..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/AppendBlobClientBuilder.java +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.util.configuration.Configuration; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLoggingPolicy; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.implementation.util.ImplUtils; -import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * Fluent AppendBlobClientBuilder for instantiating a {@link AppendBlobClient} or {@link AppendBlobAsyncClient}. - * - *

- * An instance of this builder may only be created from static method {@link AppendBlobClient#appendBlobClientBuilder()}. - * The following information must be provided on this builder: - * - *

    - *
  • the endpoint through {@code .endpoint()}, including the container name and blob name, in the format of {@code https://{accountName}.blob.core.windows.net/{containerName}/{blobName}}. - *
  • the credential through {@code .credentials()} or {@code .connectionString()} if the container is not publicly accessible. - *
- * - *

- * Once all the configurations are set on this builder, call {@code .buildClient()} to create a - * {@link AppendBlobClient} or {@code .buildAsyncClient()} to create a {@link AppendBlobAsyncClient}. - */ -public final class AppendBlobClientBuilder { - private static final String ACCOUNT_NAME = "AccountName".toLowerCase(); - private static final String ACCOUNT_KEY = "AccountKey".toLowerCase(); - - private final List policies; - - private URL endpoint; - private ICredentials credentials = new AnonymousCredentials(); - private HttpClient httpClient; - private HttpLogDetailLevel logLevel; - private RetryPolicy retryPolicy; - private Configuration configuration; - - public AppendBlobClientBuilder() { - retryPolicy = new RetryPolicy(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); - } - - /** - * Constructs an instance of AppendBlobAsyncClient based on the configurations stored in the appendBlobClientBuilder. - * @return a new client instance - */ - private AzureBlobStorageImpl buildImpl() { - Objects.requireNonNull(endpoint); - - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - policies.add(new UserAgentPolicy(BlobConfiguration.NAME, BlobConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - policies.add(credentials); // This needs to be a different credential type. - - policies.add(retryPolicy); - - policies.addAll(this.policies); - policies.add(new HttpLoggingPolicy(logLevel)); - - HttpPipeline pipeline = HttpPipeline.builder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); - - return new AzureBlobStorageBuilder() - .url(endpoint.toString()) - .pipeline(pipeline) - .build(); - } - - /** - * @return a {@link AppendBlobClient} created from the configurations in this builder. - */ - public AppendBlobClient buildClient() { - return new AppendBlobClient(buildImpl()); - } - - /** - * @return a {@link AppendBlobAsyncClient} created from the configurations in this builder. - */ - public AppendBlobAsyncClient buildAsyncClient() { - return new AppendBlobAsyncClient(buildImpl()); - } - - /** - * Sets the service endpoint, additionally parses it for information (SAS token, container name) - * @param endpoint URL of the service - * @return the updated AppendBlobClientBuilder object - */ - public AppendBlobClientBuilder endpoint(String endpoint) { - Objects.requireNonNull(endpoint); - try { - this.endpoint = new URL(endpoint); - } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage Queue endpoint url is malformed."); - } - - return this; - } - - /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials - * @return the updated AppendBlobClientBuilder object - */ - public AppendBlobClientBuilder credentials(SharedKeyCredentials credentials) { - this.credentials = credentials; - return this; - } - - /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials - * @return the updated AppendBlobClientBuilder object - */ - public AppendBlobClientBuilder credentials(TokenCredentials credentials) { - this.credentials = credentials; - return this; - } - - /** - * Clears the credentials used to authorize requests sent to the service - * @return the updated AppendBlobClientBuilder object - */ - public AppendBlobClientBuilder anonymousCredentials() { - this.credentials = new AnonymousCredentials(); - return this; - } - - /** - * Sets the connection string for the service, parses it for authentication information (account name, account key) - * @param connectionString connection string from access keys section - * @return the updated AppendBlobClientBuilder object - */ - public AppendBlobClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - - Map connectionKVPs = new HashMap<>(); - for (String s : connectionString.split(";")) { - String[] kvp = s.split("=", 2); - connectionKVPs.put(kvp[0].toLowerCase(), kvp[1]); - } - - String accountName = connectionKVPs.get(ACCOUNT_NAME); - String accountKey = connectionKVPs.get(ACCOUNT_KEY); - - if (ImplUtils.isNullOrEmpty(accountName) || ImplUtils.isNullOrEmpty(accountKey)) { - throw new IllegalArgumentException("Connection string must contain 'AccountName' and 'AccountKey'."); - } - - // Use accountName and accountKey to get the SAS token using the credential class. - credentials = new SharedKeyCredentials(accountName, accountKey); - - return this; - } - - /** - * Sets the http client used to send service requests - * @param httpClient http client to send requests - * @return the updated AppendBlobClientBuilder object - */ - public AppendBlobClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /** - * Adds a pipeline policy to apply on each request sent - * @param pipelinePolicy a pipeline policy - * @return the updated AppendBlobClientBuilder object - */ - public AppendBlobClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - this.policies.add(pipelinePolicy); - return this; - } - - /** - * Sets the logging level for service requests - * @param logLevel logging level - * @return the updated AppendBlobClientBuilder object - */ - public AppendBlobClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { - this.logLevel = logLevel; - return this; - } - - /** - * Sets the configuration object used to retrieve environment configuration values used to buildClient the client with - * when they are not set in the appendBlobClientBuilder, defaults to Configuration.NONE - * @param configuration configuration store - * @return the updated AppendBlobClientBuilder object - */ - public AppendBlobClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/AppendBlobRawClient.java b/storage/client/src/main/java/com/azure/storage/blob/AppendBlobRawClient.java deleted file mode 100644 index 22abc039755b6..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/AppendBlobRawClient.java +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.*; -import io.netty.buffer.ByteBuf; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.net.URL; -import java.nio.ByteBuffer; -import java.time.Duration; - - -/** - * Represents a URL to an append blob. It may be obtained by direct construction or via the create method on a - * {@link ContainerAsyncClient} object. This class does not hold any state about a particular append blob but is instead a - * convenient way of sending off appropriate requests to the resource on the service. Please refer to the - * Azure Docs - */ -final class AppendBlobRawClient extends BlobRawClient { - - AppendBlobAsyncRawClient appendBlobAsyncRawClient; - - /** - * Indicates the maximum number of bytes that can be sent in a call to appendBlock. - */ - public static final int MAX_APPEND_BLOCK_BYTES = 4 * Constants.MB; - - /** - * Indicates the maximum number of blocks allowed in an append blob. - */ - public static final int MAX_BLOCKS = 50000; - - /** - * Creates a {@code AppendBlobAsyncRawClient} object pointing to the account specified by the URL and using the provided - * pipeline to make HTTP requests. - * {@link StorageURL#createPipeline(ICredentials, PipelineOptions)} for more information. - */ - AppendBlobRawClient(AzureBlobStorageImpl azureBlobStorage) { - super(azureBlobStorage); - this.appendBlobAsyncRawClient = new AppendBlobAsyncRawClient(azureBlobStorage); - } - - - /** - * Creates a 0-length append blob. Call AppendBlock to append data to an append blob. For more information, see - * the Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=append_blob "Sample code for AppendBlobAsyncRawClient.create")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public AppendBlobsCreateResponse create() { - return this.create(null, null, null, null, null); - } - - /** - * Creates a 0-length append blob. Call AppendBlock to append data to an append blob. For more information, see - * the Azure Docs. - * - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=append_blob "Sample code for AppendBlobAsyncRawClient.create")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public AppendBlobsCreateResponse create(BlobHTTPHeaders headers, Metadata metadata, - BlobAccessConditions accessConditions, Duration timeout, Context context) { - Mono response = appendBlobAsyncRawClient.create(headers, metadata, accessConditions, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Commits a new block of data to the end of the existing append blob. For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=append_blob "Sample code for AppendBlobAsyncRawClient.appendBlock")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public AppendBlobsAppendBlockResponse appendBlock(Flux data, long length) { - return this.appendBlock(data, length, null, null, null); - } - - /** - * Commits a new block of data to the end of the existing append blob. For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * @param appendBlobAccessConditions - * {@link AppendBlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=append_blob "Sample code for AppendBlobAsyncRawClient.appendBlock")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public AppendBlobsAppendBlockResponse appendBlock(Flux data, long length, - AppendBlobAccessConditions appendBlobAccessConditions, Duration timeout, Context context) { - Mono response = appendBlobAsyncRawClient.appendBlock(data, length, appendBlobAccessConditions, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Commits a new block of data from another blob to the end of this append blob. For more information, see the - * Azure Docs. - *

- * - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange - * The source {@link BlobRange} to copy. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=append_from_url "Sample code for AppendBlobAsyncRawClient.appendBlockFromUrl")] - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public AppendBlobsAppendBlockFromUrlResponse appendBlockFromUrl(URL sourceURL, BlobRange sourceRange) { - return this.appendBlockFromUrl(sourceURL, sourceRange, null, null, - null, null, null); - } - - /** - * Commits a new block of data from another blob to the end of this append blob. For more information, see the - * Azure Docs. - *

- * - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param destAccessConditions - * {@link AppendBlobAccessConditions} - * @param sourceAccessConditions - * {@link SourceModifiedAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=append_from_url "Sample code for AppendBlobAsyncRawClient.appendBlockFromUrl")] - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public AppendBlobsAppendBlockFromUrlResponse appendBlockFromUrl(URL sourceURL, BlobRange sourceRange, - byte[] sourceContentMD5, AppendBlobAccessConditions destAccessConditions, - SourceModifiedAccessConditions sourceAccessConditions, Duration timeout, Context context) { - Mono response = appendBlobAsyncRawClient.appendBlockFromUrl(sourceURL, sourceRange, sourceContentMD5, destAccessConditions, sourceAccessConditions, context); - return timeout == null - ? response.block() - : response.block(timeout); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlobAccessConditions.java b/storage/client/src/main/java/com/azure/storage/blob/BlobAccessConditions.java deleted file mode 100644 index ec115a7513fc3..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/BlobAccessConditions.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.ModifiedAccessConditions; - -/** - * This class contains values which will restrict the successful operation of a variety of requests to the conditions - * present. These conditions are entirely optional. The entire object or any of its properties may be set to null when - * passed to a method to indicate that those conditions are not desired. Please refer to the type of each field for more - * information on those particular access conditions. - */ -public final class BlobAccessConditions { - - private ModifiedAccessConditions modifiedAccessConditions; - - private LeaseAccessConditions leaseAccessConditions; - - /** - * Creates an instance which has fields set to non-null, empty values. - */ - public BlobAccessConditions() { - modifiedAccessConditions = new ModifiedAccessConditions(); - leaseAccessConditions = new LeaseAccessConditions(); - } - - /** - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used to - * construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - */ - public ModifiedAccessConditions modifiedAccessConditions() { - return modifiedAccessConditions; - } - - /** - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used to - * construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - */ - public BlobAccessConditions withModifiedAccessConditions(ModifiedAccessConditions modifiedAccessConditions) { - this.modifiedAccessConditions = modifiedAccessConditions; - return this; - } - - /** - * By setting lease access conditions, requests will fail if the provided lease does not match the active lease on - * the blob. - */ - public LeaseAccessConditions leaseAccessConditions() { - return leaseAccessConditions; - } - - /** - * By setting lease access conditions, requests will fail if the provided lease does not match the active lease on - * the blob. - */ - public BlobAccessConditions withLeaseAccessConditions(LeaseAccessConditions leaseAccessConditions) { - this.leaseAccessConditions = leaseAccessConditions; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlobAsyncClient.java b/storage/client/src/main/java/com/azure/storage/blob/BlobAsyncClient.java deleted file mode 100644 index 964caa7d90ad4..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/BlobAsyncClient.java +++ /dev/null @@ -1,818 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.rest.ResponseBase; -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.AccessTier; -import com.azure.storage.blob.models.BlobHTTPHeaders; -import com.azure.storage.blob.models.BlobStartCopyFromURLHeaders; -import com.azure.storage.blob.models.DeleteSnapshotsOptionType; -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.ModifiedAccessConditions; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.netty.ByteBufFlux; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.UncheckedIOException; -import java.net.URL; -import java.nio.ByteBuffer; - -/** - * Client to a blob of any type: block, append, or page. It may only be instantiated through a {@link BlobClientBuilder} or via - * the method {@link ContainerAsyncClient#getBlobAsyncClient(String)}. This class does not hold any state about a particular - * blob, but is instead a convenient way of sending appropriate requests to the resource on the service. - * - *

- * This client offers the ability to download blobs. Note that uploading data is specific to each type of blob. Please - * refer to the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link AppendBlobClient} for upload options. This - * client can be converted into one of these clients easily through the methods {@link #asBlockBlobAsyncClient}, - * {@link #asPageBlobAsyncClient}, and {@link #asAppendBlobAsyncClient()}. - * - *

- * This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient}, - * and operations on the service are available on {@link StorageAsyncClient}. - * - *

- * Please refer to the Azure Docs - * for more information. - * - *

- * Note this client is an async client that returns reactive responses from Spring Reactor Core - * project (https://projectreactor.io/). Calling the methods in this client will NOT - * start the actual network operation, until {@code .subscribe()} is called on the reactive response. - * You can simply convert one of these responses to a {@link java.util.concurrent.CompletableFuture} - * object through {@link Mono#toFuture()}. - */ -public class BlobAsyncClient { - - protected BlobAsyncRawClient blobAsyncRawClient; - - /** - * Package-private constructor for use by {@link BlobClientBuilder}. - * @param azureBlobStorage the API client for blob storage API - */ - BlobAsyncClient(AzureBlobStorageImpl azureBlobStorage) { - blobAsyncRawClient = new BlobAsyncRawClient(azureBlobStorage); - } - - /** - * Static method for getting a new builder for this class. - * - * @return - * A new {@link BlobClientBuilder} instance. - */ - public static BlobClientBuilder blobClientBuilder() { - return new BlobClientBuilder(); - } - - /** - * Creates a new {@link BlockBlobAsyncClient} to this resource, maintaining configurations. Only do this for blobs - * that are known to be block blobs. - * - * @return - * A {@link BlockBlobAsyncClient} to this resource. - */ - public BlockBlobAsyncClient asBlockBlobAsyncClient() { - return new BlockBlobAsyncClient(this.blobAsyncRawClient.azureBlobStorage); - } - - /** - * Creates a new {@link AppendBlobAsyncClient} to this resource, maintaining configurations. Only do this for blobs - * that are known to be append blobs. - * - * @return - * A {@link AppendBlobAsyncClient} to this resource. - */ - public AppendBlobAsyncClient asAppendBlobAsyncClient() { - return new AppendBlobAsyncClient(this.blobAsyncRawClient.azureBlobStorage); - } - - /** - * Creates a new {@link PageBlobAsyncClient} to this resource, maintaining configurations. Only do this for blobs - * that are known to be page blobs. - * - * @return - * A {@link PageBlobAsyncClient} to this resource. - */ - public PageBlobAsyncClient asPageBlobAsyncClient() { - return new PageBlobAsyncClient(this.blobAsyncRawClient.azureBlobStorage); - } - - - /** - * Copies the data at the source URL to a blob. For more information, see the Azure Docs - * - * @param sourceURL - * The source URL to copy from. URLs outside of Azure may only be copied to block blobs. - * - * @return - * A reactive response containing the copy ID for the long running operation. - */ - public Mono startCopyFromURL(URL sourceURL) { - return this.startCopyFromURL(sourceURL, null, null, null, null); - } - - /** - * Copies the data at the source URL to a blob. For more information, see the Azure Docs - * - * @param sourceURL - * The source URL to copy from. URLs outside of Azure may only be copied to block blobs. - * @param metadata - * {@link Metadata} - * @param sourceModifiedAccessConditions - * {@link ModifiedAccessConditions} against the source. Standard HTTP Access conditions related to the - * modification of data. ETag and LastModifiedTime are used to construct conditions related to when the blob - * was changed relative to the given request. The request will fail if the specified condition is not - * satisfied. - * @param destAccessConditions - * {@link BlobAccessConditions} against the destination. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the copy ID for the long running operation. - */ - public Mono startCopyFromURL(URL sourceURL, Metadata metadata, - ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, - Context context) { - return blobAsyncRawClient - .startCopyFromURL(sourceURL, metadata, sourceModifiedAccessConditions, destAccessConditions, context) - .map(response -> response.deserializedHeaders().copyId()); - } - - /** - * Stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. - * - * @param copyId - * The id of the copy operation to abort. Returned as the {@code copyId} field on the {@link - * BlobStartCopyFromURLHeaders} object. - * - * @return - * A reactive response signalling completion. - */ - public Mono abortCopyFromURL(String copyId) { - return this.abortCopyFromURL(copyId, null, null); - } - - /** - * Stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. - * - * @param copyId - * The id of the copy operation to abort. Returned as the {@code copyId} field on the {@link - * BlobStartCopyFromURLHeaders} object. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response signalling completion. - */ - public Mono abortCopyFromURL(String copyId, LeaseAccessConditions leaseAccessConditions, Context context) { - return blobAsyncRawClient - .abortCopyFromURL(copyId, leaseAccessConditions, context) - .then(); - } - - /** - * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. - * - * @param copySource - * The source URL to copy from. - * - * @return - * A reactive response containing the copy ID for the long running operation. - */ - public Mono copyFromURL(URL copySource) { - return this.copyFromURL(copySource, null, null, null, null); - } - - /** - * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. - * - * @param copySource - * The source URL to copy from. URLs outside of Azure may only be copied to block blobs. - * @param metadata - * {@link Metadata} - * @param sourceModifiedAccessConditions - * {@link ModifiedAccessConditions} against the source. Standard HTTP Access conditions related to the - * modification of data. ETag and LastModifiedTime are used to construct conditions related to when the blob - * was changed relative to the given request. The request will fail if the specified condition is not - * satisfied. - * @param destAccessConditions - * {@link BlobAccessConditions} against the destination. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the copy ID for the long running operation. - */ - public Mono copyFromURL(URL copySource, Metadata metadata, - ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, - Context context) { - return blobAsyncRawClient - .syncCopyFromURL(copySource, metadata, sourceModifiedAccessConditions, destAccessConditions, context) - .map(response -> response.deserializedHeaders().copyId()); - } - - /** - * Reads the entire blob. Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link AppendBlobClient}. - * - * @return - * A reactive response containing the blob data. - */ - public Flux download() { - return this.download(null, null, false, null, null); - } - - /** - * Reads a range of bytes from a blob. Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link AppendBlobClient}. - * - * @param range - * {@link BlobRange} - * @param accessConditions - * {@link BlobAccessConditions} - * @param rangeGetContentMD5 - * Whether the contentMD5 for the specified blob range should be returned. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the blob data. - */ - public Flux download(BlobRange range, BlobAccessConditions accessConditions, - boolean rangeGetContentMD5, ReliableDownloadOptions options, Context context) { - return blobAsyncRawClient - .download(range, accessConditions, rangeGetContentMD5, context) - .flatMapMany(response -> ByteBufFlux.fromInbound(response.body(options)).asByteBuffer()); - } - - /** - * Downloads the entire blob into a file specified by the path. The file will be created if it doesn't exist. - * Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link AppendBlobClient}. - * - * @param filePath - * A non-null {@link OutputStream} instance where the downloaded data will be written. - */ - public Mono downloadToFile(String filePath) { - return this.downloadToFile(filePath, null, null, false, null, null); - } - - /** - * Downloads a range of bytes blob into a file specified by the path. The file will be created if it doesn't exist. - * Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link AppendBlobClient}. - * - * @param filePath - * A non-null {@link OutputStream} instance where the downloaded data will be written. - * @param range - * {@link BlobRange} - * @param accessConditions - * {@link BlobAccessConditions} - * @param rangeGetContentMD5 - * Whether the contentMD5 for the specified blob range should be returned. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - */ - public Mono downloadToFile(String filePath, BlobRange range, BlobAccessConditions accessConditions, - boolean rangeGetContentMD5, ReliableDownloadOptions options, Context context) { - //todo make this method smart - return Mono.using( - () -> new FileOutputStream(new File(filePath)), - fstream -> this.download(range, accessConditions, rangeGetContentMD5, options, context) - .doOnNext(byteBuffer -> { - try { - fstream.write(byteBuffer.array()); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - }) - .then(), - fstream -> { - try { - fstream.close(); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - } - ); - } - - /** - * Deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. - * - * @return - * A reactive response signalling completion. - */ - public Mono delete() { - return this.delete(null, null, null); - } - - /** - * Deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. - * - * @param deleteBlobSnapshotOptions - * Specifies the behavior for deleting the snapshots on this blob. {@code Include} will delete the base blob - * and all snapshots. {@code Only} will delete only the snapshots. If a snapshot is being deleted, you must - * pass null. - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response signalling completion. - */ - public Mono delete(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, - BlobAccessConditions accessConditions, Context context) { - return blobAsyncRawClient - .delete(deleteBlobSnapshotOptions, accessConditions, context) - .then(); - } - - /** - * Returns the blob's metadata and properties. - * - * @return - * A reactive response containing the blob properties and metadata. - */ - public Mono getProperties() { - return this.getProperties(null, null); - } - - /** - * Returns the blob's metadata and properties. - * - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the blob properties and metadata. - */ - public Mono getProperties(BlobAccessConditions accessConditions, Context context) { - return blobAsyncRawClient - .getProperties(accessConditions, context) - .map(ResponseBase::deserializedHeaders) - .map(BlobProperties::new); - } - - /** - * Changes a blob's HTTP header properties. if only one HTTP header is updated, the - * others will all be erased. In order to preserve existing values, they must be - * passed alongside the header being changed. For more information, see the - * Azure Docs. - * - * @param headers - * {@link BlobHTTPHeaders} - * - * @return - * A reactive response signalling completion. - */ - public Mono setHTTPHeaders(BlobHTTPHeaders headers) { - return this.setHTTPHeaders(headers, null, null); - } - - /** - * Changes a blob's HTTP header properties. if only one HTTP header is updated, the - * others will all be erased. In order to preserve existing values, they must be - * passed alongside the header being changed. For more information, see the - * Azure Docs. - * - * @param headers - * {@link BlobHTTPHeaders} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response signalling completion. - */ - public Mono setHTTPHeaders(BlobHTTPHeaders headers, BlobAccessConditions accessConditions, Context context) { - return blobAsyncRawClient - .setHTTPHeaders(headers, accessConditions, context) - .then(); - } - - /** - * Changes a blob's metadata. The specified metadata in this method will replace existing - * metadata. If old values must be preserved, they must be downloaded and included in the - * call to this method. For more information, see the Azure Docs. - * - * @param metadata - * {@link Metadata} - * - * @return - * A reactive response signalling completion. - */ - public Mono setMetadata(Metadata metadata) { - return this.setMetadata(metadata, null, null); - } - - /** - * Changes a blob's metadata. The specified metadata in this method will replace existing - * metadata. If old values must be preserved, they must be downloaded and included in the - * call to this method. For more information, see the Azure Docs. - * - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response signalling completion. - */ - public Mono setMetadata(Metadata metadata, BlobAccessConditions accessConditions, Context context) { - return blobAsyncRawClient - .setMetadata(metadata, accessConditions, context) - .then(); - } - - /** - * Creates a read-only snapshot of a blob. - * - * @return - * A reactive response containing the ID of the new snapshot. - */ - public Mono createSnapshot() { - return this.createSnapshot(null, null, null); - } - - /** - * Creates a read-only snapshot of a blob. - * - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the ID of the new snapshot. - */ - public Mono createSnapshot(Metadata metadata, BlobAccessConditions accessConditions, Context context) { - return blobAsyncRawClient - .createSnapshot(metadata, accessConditions, context) - .map(response -> response.deserializedHeaders().snapshot()); - } - - /** - * Sets the tier on a blob. The operation is allowed on a page blob in a premium storage account or a block blob in - * a blob storage or GPV2 account. A premium page blob's tier determines the allowed size, IOPS, and bandwidth of - * the blob. A block blob's tier determines the Hot/Cool/Archive storage type. This does not update the blob's etag. - * - * @param tier - * The new tier for the blob. - * - * @return - * A reactive response signalling completion. - */ - public Mono setTier(AccessTier tier) { - return this.setTier(tier, null, null); - } - - /** - * Sets the tier on a blob. The operation is allowed on a page blob in a premium storage account or a block blob in - * a blob storage or GPV2 account. A premium page blob's tier determines the allowed size, IOPS, and bandwidth of - * the blob. A block blob's tier determines the Hot/Cool/Archive storage type. This does not update the blob's etag. - * - * @param tier - * The new tier for the blob. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response signalling completion. - */ - public Mono setTier(AccessTier tier, LeaseAccessConditions leaseAccessConditions, Context context) { - return blobAsyncRawClient - .setTier(tier, leaseAccessConditions, context) - .then(); - } - - /** - * Undelete restores the content and metadata of a soft-deleted blob and/or any associated soft-deleted snapshots. - * - * @return - * A reactive response signalling completion. - */ - public Mono undelete() { - return this.undelete(null); - } - - /** - * Undelete restores the content and metadata of a soft-deleted blob and/or any associated soft-deleted snapshots. - * - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return - * A reactive response signalling completion. - */ - public Mono undelete(Context context) { - return blobAsyncRawClient - .undelete(context) - .then(); - } - - /** - * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 - * seconds, or infinite (-1). - * - * @param proposedId - * A {@code String} in any valid GUID format. May be null. - * @param duration - * The duration of the lease, in seconds, or negative one (-1) for a lease that - * never expires. A non-infinite lease can be between 15 and 60 seconds. - * - * @return - * A reactive response containing the lease ID. - */ - public Mono acquireLease(String proposedId, int duration) { - return this.acquireLease(proposedId, duration, null, null); - } - - /** - * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 - * seconds, or infinite (-1). - * - * @param proposedID - * A {@code String} in any valid GUID format. May be null. - * @param duration - * The duration of the lease, in seconds, or negative one (-1) for a lease that - * never expires. A non-infinite lease can be between 15 and 60 seconds. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the lease ID. - */ - public Mono acquireLease(String proposedID, int duration, ModifiedAccessConditions modifiedAccessConditions, - Context context) { - return blobAsyncRawClient - .acquireLease(proposedID, duration, modifiedAccessConditions, context) - .map(response -> response.deserializedHeaders().leaseId()); - } - - /** - * Renews the blob's previously-acquired lease. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * - * @return - * A reactive response containing the renewed lease ID. - */ - public Mono renewLease(String leaseID) { - return this.renewLease(leaseID, null, null); - } - - /** - * Renews the blob's previously-acquired lease. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the renewed lease ID. - */ - public Mono renewLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions, Context context) { - return blobAsyncRawClient - .renewLease(leaseID, modifiedAccessConditions, context) - .map(response -> response.deserializedHeaders().leaseId()); - } - - /** - * Releases the blob's previously-acquired lease. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * - * @return - * A reactive response signalling completion. - */ - public Mono releaseLease(String leaseID) { - return this.releaseLease(leaseID, null, null); - } - - /** - * Releases the blob's previously-acquired lease. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response signalling completion. - */ - public Mono releaseLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions, Context context) { - return blobAsyncRawClient - .releaseLease(leaseID, modifiedAccessConditions, context) - .then(); - } - - /** - * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant - * to break a fixed-duration lease when it expires or an infinite lease immediately. - * - * @return - * A reactive response containing the remaining time in the broken lease in seconds. - */ - public Mono breakLease() { - return this.breakLease(null, null, null); - } - - /** - * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant - * to break a fixed-duration lease when it expires or an infinite lease immediately. - * - * @param breakPeriodInSeconds - * An optional {@code Integer} representing the proposed duration of seconds that the lease should continue - * before it is broken, between 0 and 60 seconds. This break period is only used if it is shorter than the - * time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be - * available before the break period has expired, but the lease may be held for longer than the break - * period. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the remaining time in the broken lease in seconds. - */ - public Mono breakLease(Integer breakPeriodInSeconds, ModifiedAccessConditions modifiedAccessConditions, - Context context) { - return blobAsyncRawClient - .breakLease(breakPeriodInSeconds, modifiedAccessConditions, context) - .map(response -> response.deserializedHeaders().leaseTime()); - } - - /** - * ChangeLease changes the blob's lease ID. - * - * @param leaseId - * The leaseId of the active lease on the blob. - * @param proposedID - * A {@code String} in any valid GUID format. - * - * @return - * A reactive response containing the new lease ID. - */ - public Mono changeLease(String leaseId, String proposedID) { - return this.changeLease(leaseId, proposedID, null, null); - } - - /** - * ChangeLease changes the blob's lease ID. For more information, see the Azure Docs. - * - * @param leaseId - * The leaseId of the active lease on the blob. - * @param proposedID - * A {@code String} in any valid GUID format. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return A reactive response containing the new lease ID. - */ - public Mono changeLease(String leaseId, String proposedID, ModifiedAccessConditions modifiedAccessConditions, - Context context) { - return blobAsyncRawClient - .changeLease(leaseId, proposedID, modifiedAccessConditions, context) - .map(response -> response.deserializedHeaders().leaseId()); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the Azure Docs. - * - * @return a reactor response containing the sku name and account kind. - */ - public Mono getAccountInfo() { - return this.getAccountInfo(null); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the Azure Docs. - * - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return a reactor response containing the sku name and account kind. - */ - // TODO determine this return type - public Mono getAccountInfo(Context context) { - return blobAsyncRawClient - .getAccountInfo(context) - .map(ResponseBase::deserializedHeaders) - .map(StorageAccountInfo::new); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlobAsyncRawClient.java b/storage/client/src/main/java/com/azure/storage/blob/BlobAsyncRawClient.java deleted file mode 100644 index 12360ccf0de5b..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/BlobAsyncRawClient.java +++ /dev/null @@ -1,897 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.*; -import reactor.core.publisher.Mono; - -import java.net.URL; - -import static com.azure.storage.blob.Utility.postProcessResponse; - -/** - * Represents a URL to a blob of any type: block, append, or page. It may be obtained by direct construction or via the - * create method on a {@link ContainerAsyncClient} object. This class does not hold any state about a particular blob but is - * instead a convenient way of sending off appropriate requests to the resource on the service. Please refer to the - * Azure Docs for more information. - */ -class BlobAsyncRawClient { - - protected AzureBlobStorageImpl azureBlobStorage; - - /** - * Creates a {@code BlobAsyncRawClient} object pointing to the account specified by the URL and using the provided pipeline to - * make HTTP requests.. - */ - BlobAsyncRawClient(AzureBlobStorageImpl azureBlobStorage) { - this.azureBlobStorage = azureBlobStorage; - } - - /** - * Copies the data at the source URL to a blob. For more information, see the Azure Docs - * - * @param sourceURL - * The source URL to copy from. URLs outside of Azure may only be copied to block blobs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=start_copy "Sample code for BlobAsyncRawClient.startCopyFromURL")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=start_copy_helper "Helper for start_copy sample.")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono startCopyFromURL(URL sourceURL) { - return this.startCopyFromURL(sourceURL, null, null, null, null); - } - - /** - * Copies the data at the source URL to a blob. For more information, see the Azure Docs - * - * @param sourceURL - * The source URL to copy from. URLs outside of Azure may only be copied to block blobs. - * @param metadata - * {@link Metadata} - * @param sourceModifiedAccessConditions - * {@link ModifiedAccessConditions} against the source. Standard HTTP Access conditions related to the - * modification of data. ETag and LastModifiedTime are used to construct conditions related to when the blob - * was changed relative to the given request. The request will fail if the specified condition is not - * satisfied. - * @param destAccessConditions - * {@link BlobAccessConditions} against the destination. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=start_copy "Sample code for BlobAsyncRawClient.startCopyFromURL")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=start_copy_helper "Helper for start_copy sample.")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono startCopyFromURL(URL sourceURL, Metadata metadata, - ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, - Context context) { - metadata = metadata == null ? new Metadata() : metadata; - sourceModifiedAccessConditions = sourceModifiedAccessConditions == null - ? new ModifiedAccessConditions() : sourceModifiedAccessConditions; - destAccessConditions = destAccessConditions == null ? new BlobAccessConditions() : destAccessConditions; - context = context == null ? Context.NONE : context; - - // We want to hide the SourceAccessConditions type from the user for consistency's sake, so we convert here. - SourceModifiedAccessConditions sourceConditions = new SourceModifiedAccessConditions() - .sourceIfModifiedSince(sourceModifiedAccessConditions.ifModifiedSince()) - .sourceIfUnmodifiedSince(sourceModifiedAccessConditions.ifUnmodifiedSince()) - .sourceIfMatch(sourceModifiedAccessConditions.ifMatch()) - .sourceIfNoneMatch(sourceModifiedAccessConditions.ifNoneMatch()); - - return postProcessResponse(this.azureBlobStorage.blobs().startCopyFromURLWithRestResponseAsync( - null, null, sourceURL, null, metadata, null, sourceConditions, - destAccessConditions.modifiedAccessConditions(), destAccessConditions.leaseAccessConditions(), context)); - } - - /** - * Stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. For - * more information, see the Azure Docs. - * - * @param copyId - * The id of the copy operation to abort. Returned as the {@code copyId} field on the {@link - * BlobStartCopyFromURLHeaders} object. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=abort_copy "Sample code for BlobAsyncRawClient.abortCopyFromURL")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono abortCopyFromURL(String copyId) { - return this.abortCopyFromURL(copyId, null, null); - } - - /** - * Stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. For - * more information, see the Azure Docs. - * - * @param copyId - * The id of the copy operation to abort. Returned as the {@code copyId} field on the {@link - * BlobStartCopyFromURLHeaders} object. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=abort_copy "Sample code for BlobAsyncRawClient.abortCopyFromURL")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono abortCopyFromURL(String copyId, - LeaseAccessConditions leaseAccessConditions, Context context) { - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.blobs().abortCopyFromURLWithRestResponseAsync( - null, null, copyId, null, null, leaseAccessConditions, context)); - } - - /** - * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. - * For more information, see the Azure Docs - * - * @param copySource - * The source URL to copy from. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=sync_copy "Sample code for BlobAsyncRawClient.copyFromURL")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono syncCopyFromURL(URL copySource) { - return this.syncCopyFromURL(copySource, null, null, null, null); - } - - /** - * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. - * For more information, see the Azure Docs - * - * @param copySource - * The source URL to copy from. URLs outside of Azure may only be copied to block blobs. - * @param metadata - * {@link Metadata} - * @param sourceModifiedAccessConditions - * {@link ModifiedAccessConditions} against the source. Standard HTTP Access conditions related to the - * modification of data. ETag and LastModifiedTime are used to construct conditions related to when the blob - * was changed relative to the given request. The request will fail if the specified condition is not - * satisfied. - * @param destAccessConditions - * {@link BlobAccessConditions} against the destination. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=sync_copy "Sample code for BlobAsyncRawClient.copyFromURL")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono syncCopyFromURL(URL copySource, Metadata metadata, - ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, - Context context) { - metadata = metadata == null ? new Metadata() : metadata; - sourceModifiedAccessConditions = sourceModifiedAccessConditions == null - ? new ModifiedAccessConditions() : sourceModifiedAccessConditions; - destAccessConditions = destAccessConditions == null ? new BlobAccessConditions() : destAccessConditions; - context = context == null ? Context.NONE : context; - - // We want to hide the SourceAccessConditions type from the user for consistency's sake, so we convert here. - SourceModifiedAccessConditions sourceConditions = new SourceModifiedAccessConditions() - .sourceIfModifiedSince(sourceModifiedAccessConditions.ifModifiedSince()) - .sourceIfUnmodifiedSince(sourceModifiedAccessConditions.ifUnmodifiedSince()) - .sourceIfMatch(sourceModifiedAccessConditions.ifMatch()) - .sourceIfNoneMatch(sourceModifiedAccessConditions.ifNoneMatch()); - - return postProcessResponse(this.azureBlobStorage.blobs().copyFromURLWithRestResponseAsync( - null, null, copySource, null, metadata, null, sourceConditions, - destAccessConditions.modifiedAccessConditions(), destAccessConditions.leaseAccessConditions(), context)); - } - - /** - * Reads a range of bytes from a blob. The response also includes the blob's properties and metadata. For more - * information, see the Azure Docs. - *

- * Note that the response body has reliable download functionality built in, meaning that a failed download stream - * will be automatically retried. This behavior may be configured with {@link ReliableDownloadOptions}. - * - * @return Emits the successful response. - * @apiNote ## Sample Code \n [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=upload_download - * "Sample code for BlobAsyncRawClient.download")] \n For more samples, please see the [Samples - * file](%https://github.com/Azure/azure-storage-java/blob/New-Storage-SDK-V10-Preview/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono download() { - return this.download(null, null, false, null); - } - - /** - * Reads a range of bytes from a blob. The response also includes the blob's properties and metadata. For more - * information, see the Azure Docs. - *

- * Note that the response body has reliable download functionality built in, meaning that a failed download stream - * will be automatically retried. This behavior may be configured with {@link ReliableDownloadOptions}. - * - * @param range - * {@link BlobRange} - * @param accessConditions - * {@link BlobAccessConditions} - * @param rangeGetContentMD5 - * Whether the contentMD5 for the specified blob range should be returned. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=upload_download "Sample code for BlobAsyncRawClient.download")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono download(BlobRange range, BlobAccessConditions accessConditions, - boolean rangeGetContentMD5, Context context) { - Boolean getMD5 = rangeGetContentMD5 ? rangeGetContentMD5 : null; - range = range == null ? new BlobRange(0) : range; - accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; - HTTPGetterInfo info = new HTTPGetterInfo() - .withOffset(range.offset()) - .withCount(range.count()) - .withETag(accessConditions.modifiedAccessConditions().ifMatch()); - - // TODO: range is BlobRange but expected as String - // TODO: figure out correct response - return postProcessResponse(this.azureBlobStorage.blobs().downloadWithRestResponseAsync( - null, null, null, null, null, range.toHeaderValue(), getMD5, - null, null, null, null, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), context)) - // Convert the autorest response to a DownloadAsyncResponse, which enable reliable download. - .map(response -> { - // If there wasn't an etag originally specified, lock on the one returned. - info.withETag(response.deserializedHeaders().eTag()); - return new DownloadAsyncResponse(response, info, - // In the event of a stream failure, make a new request to pick up where we left off. - newInfo -> - this.download(new BlobRange(newInfo.offset(), newInfo.count()), - new BlobAccessConditions().withModifiedAccessConditions( - new ModifiedAccessConditions().ifMatch(info.eTag())), false, - context == null ? Context.NONE : context)); - }); - } - - /** - * Deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. For more - * information, see the Azure Docs. - * - * @return Emits the successful response. - * @apiNote ## Sample Code \n [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_delete - * "Sample code for BlobAsyncRawClient.delete")] \n For more samples, please see the [Samples - * file](%https://github.com/Azure/azure-storage-java/blob/New-Storage-SDK-V10-Preview/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono delete() { - return this.delete(null, null, null); - } - - /** - * Deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. For more - * information, see the Azure Docs. - * - * @param deleteBlobSnapshotOptions - * Specifies the behavior for deleting the snapshots on this blob. {@code Include} will delete the base blob - * and all snapshots. {@code Only} will delete only the snapshots. If a snapshot is being deleted, you must - * pass null. - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_delete "Sample code for BlobAsyncRawClient.delete")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono delete(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, - BlobAccessConditions accessConditions, Context context) { - accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.blobs().deleteWithRestResponseAsync( - null, null, null, null, null, deleteBlobSnapshotOptions, - null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), - context)); - } - - /** - * Returns the blob's metadata and properties. For more information, see the Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=properties_metadata "Sample code for BlobAsyncRawClient.getProperties")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getProperties() { - return this.getProperties(null, null); - } - - /** - * Returns the blob's metadata and properties. For more information, see the Azure Docs. - * - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=properties_metadata "Sample code for BlobAsyncRawClient.getProperties")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getProperties(BlobAccessConditions accessConditions, Context context) { - accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.blobs().getPropertiesWithRestResponseAsync( - null, null, null, null, null, null, - null, null, null, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), context)); - } - - /** - * Changes a blob's HTTP header properties. For more information, see the Azure - * Docs. - * - * @param headers - * {@link BlobHTTPHeaders} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=properties_metadata "Sample code for BlobAsyncRawClient.setHTTPHeaders")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono setHTTPHeaders(BlobHTTPHeaders headers) { - return this.setHTTPHeaders(headers, null, null); - } - - /** - * Changes a blob's HTTP header properties. For more information, see the Azure Docs. - * - * @param headers - * {@link BlobHTTPHeaders} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=properties_metadata "Sample code for BlobAsyncRawClient.setHTTPHeaders")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono setHTTPHeaders(BlobHTTPHeaders headers, - BlobAccessConditions accessConditions, Context context) { - accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.blobs().setHTTPHeadersWithRestResponseAsync( - null, null, null, null, headers, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), context)); - } - - /** - * Changes a blob's metadata. For more information, see the Azure Docs. - * - * @param metadata - * {@link Metadata} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=properties_metadata "Sample code for BlobAsyncRawClient.setMetadata")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono setMetadata(Metadata metadata) { - return this.setMetadata(metadata, null, null); - } - - /** - * Changes a blob's metadata. For more information, see the Azure Docs. - * - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=properties_metadata "Sample code for BlobAsyncRawClient.setMetadata")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono setMetadata(Metadata metadata, BlobAccessConditions accessConditions, - Context context) { - metadata = metadata == null ? new Metadata() : metadata; - accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.blobs().setMetadataWithRestResponseAsync( - null, null, null, metadata, null, null, - null, null, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), context)); - } - - /** - * Creates a read-only snapshot of a blob. For more information, see the Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=snapshot "Sample code for BlobAsyncRawClient.createSnapshot")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono createSnapshot() { - return this.createSnapshot(null, null, null); - } - - /** - * Creates a read-only snapshot of a blob. For more information, see the Azure Docs. - * - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=snapshot "Sample code for BlobAsyncRawClient.createSnapshot")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono createSnapshot(Metadata metadata, BlobAccessConditions accessConditions, - Context context) { - metadata = metadata == null ? new Metadata() : metadata; - accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.blobs().createSnapshotWithRestResponseAsync( - null, null, null, metadata, null, null, - null, null, accessConditions.modifiedAccessConditions(), - accessConditions.leaseAccessConditions(), context)); - } - - /** - * Sets the tier on a blob. The operation is allowed on a page blob in a premium storage account or a block blob in - * a blob storage or GPV2 account. A premium page blob's tier determines the allowed size, IOPS, and bandwidth of - * the blob. A block blob's tier determines the Hot/Cool/Archive storage type. This does not update the blob's etag. - *

- * For detailed information about block blob level tiering see the Azure Docs. - * - * @param tier - * The new tier for the blob. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=tier "Sample code for BlobAsyncRawClient.setTier")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono setTier(AccessTier tier) { - return this.setTier(tier, null, null); - } - - /** - * Sets the tier on a blob. The operation is allowed on a page blob in a premium storage account or a block blob in - * a blob storage or GPV2 account. A premium page blob's tier determines the allowed size, IOPS, and bandwidth of - * the blob. A block blob's tier determines the Hot/Cool/Archive storage type. This does not update the blob's etag. - *

- * For detailed information about block blob level tiering see the Azure Docs. - * - * @param tier - * The new tier for the blob. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=tier "Sample code for BlobAsyncRawClient.setTier")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono setTier(AccessTier tier, LeaseAccessConditions leaseAccessConditions, - Context context) { - Utility.assertNotNull("tier", tier); - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.blobs().setTierWithRestResponseAsync( - null, null, tier, null, null, leaseAccessConditions, context)); - } - - /** - * Undelete restores the content and metadata of a soft-deleted blob and/or any associated soft-deleted snapshots. - * For more information, see the Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=undelete "Sample code for BlobAsyncRawClient.undelete")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono undelete() { - return this.undelete(null); - } - - /** - * Undelete restores the content and metadata of a soft-deleted blob and/or any associated soft-deleted snapshots. - * For more information, see the Azure Docs. - * - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=undelete "Sample code for BlobAsyncRawClient.undelete")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono undelete(Context context) { - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.blobs().undeleteWithRestResponseAsync(null, - null, context)); - } - - /** - * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 - * seconds, or infinite (-1). For more information, see the Azure Docs. - * - * @param proposedId - * A {@code String} in any valid GUID format. May be null. - * @param duration - * The duration of the lease, in seconds, or negative one (-1) for a lease that - * never expires. A non-infinite lease can be between 15 and 60 seconds. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.acquireLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono acquireLease(String proposedId, int duration) { - return this.acquireLease(proposedId, duration, null, null); - } - - /** - * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 - * seconds, or infinite (-1). For more information, see the Azure Docs. - * - * @param proposedID - * A {@code String} in any valid GUID format. May be null. - * @param duration - * The duration of the lease, in seconds, or negative one (-1) for a lease that - * never expires. A non-infinite lease can be between 15 and 60 seconds. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.acquireLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono acquireLease(String proposedID, int duration, - ModifiedAccessConditions modifiedAccessConditions, Context context) { - if (!(duration == -1 || (duration >= 15 && duration <= 60))) { - // Throwing is preferred to Mono.error because this will error out immediately instead of waiting until - // subscription. - throw new IllegalArgumentException("Duration must be -1 or between 15 and 60."); - } - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.blobs().acquireLeaseWithRestResponseAsync( - null, null, null, duration, proposedID, null, - modifiedAccessConditions, context)); - } - - /** - * Renews the blob's previously-acquired lease. For more information, see the Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.renewLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono renewLease(String leaseID) { - return this.renewLease(leaseID, null, null); - } - - /** - * Renews the blob's previously-acquired lease. For more information, see the Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.renewLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono renewLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions, - Context context) { - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.blobs().renewLeaseWithRestResponseAsync(null, - null, leaseID, null, null, modifiedAccessConditions, context)); - } - - /** - * Releases the blob's previously-acquired lease. For more information, see the Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.releaseLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono releaseLease(String leaseID) { - return this.releaseLease(leaseID, null, null); - } - - /** - * Releases the blob's previously-acquired lease. For more information, see the Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.releaseLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono releaseLease(String leaseID, - ModifiedAccessConditions modifiedAccessConditions, Context context) { - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.blobs().releaseLeaseWithRestResponseAsync(null, - null, leaseID, null, null, modifiedAccessConditions, context)); - } - - /** - * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant - * to break a fixed-duration lease when it expires or an infinite lease immediately. For more information, see the - * Azure Docs. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.breakLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/New-Storage-SDK-V10-Preview/src/test/java/com/microsoft/azure/storage/Samples.java) - * - * @return - * Emits the successful response. - */ - public Mono breakLease() { - return this.breakLease(null, null, null); - } - - /** - * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant - * to break a fixed-duration lease when it expires or an infinite lease immediately. For more information, see the - * Azure Docs. - * - * @param breakPeriodInSeconds - * An optional {@code Integer} representing the proposed duration of seconds that the lease should continue - * before it is broken, between 0 and 60 seconds. This break period is only used if it is shorter than the - * time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be - * available before the break period has expired, but the lease may be held for longer than the break - * period. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.breakLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono breakLease(Integer breakPeriodInSeconds, - ModifiedAccessConditions modifiedAccessConditions, Context context) { - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.blobs().breakLeaseWithRestResponseAsync(null, - null, null, breakPeriodInSeconds, null, modifiedAccessConditions, context)); - } - - /** - * ChangeLease changes the blob's lease ID. For more information, see the Azure Docs. - * - * @param leaseId - * The leaseId of the active lease on the blob. - * @param proposedID - * A {@code String} in any valid GUID format. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.changeLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono changeLease(String leaseId, String proposedID) { - return this.changeLease(leaseId, proposedID, null, null); - } - - /** - * ChangeLease changes the blob's lease ID. For more information, see the Azure Docs. - * - * @param leaseId - * The leaseId of the active lease on the blob. - * @param proposedID - * A {@code String} in any valid GUID format. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.changeLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono changeLease(String leaseId, String proposedID, - ModifiedAccessConditions modifiedAccessConditions, Context context) { - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.blobs().changeLeaseWithRestResponseAsync(null, - null, leaseId, proposedID, null, null, modifiedAccessConditions, context)); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=account_info "Sample code for BlobAsyncRawClient.getAccountInfo")] \n - * For more samples, please see the [Samples file](https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getAccountInfo() { - return this.getAccountInfo(null); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the Azure Docs. - * - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=account_info "Sample code for BlobAsyncRawClient.getAccountInfo")] \n - * For more samples, please see the [Samples file](https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getAccountInfo(Context context) { - context = context == null ? Context.NONE : context; - - return postProcessResponse( - this.azureBlobStorage.blobs().getAccountInfoWithRestResponseAsync(null, null, context)); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlobClient.java b/storage/client/src/main/java/com/azure/storage/blob/BlobClient.java deleted file mode 100644 index b1b49e1f32cda..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/BlobClient.java +++ /dev/null @@ -1,756 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.AccessTier; -import com.azure.storage.blob.models.BlobHTTPHeaders; -import com.azure.storage.blob.models.BlobStartCopyFromURLHeaders; -import com.azure.storage.blob.models.DeleteSnapshotsOptionType; -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.ModifiedAccessConditions; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.UncheckedIOException; -import java.net.URL; -import java.nio.ByteBuffer; -import java.time.Duration; - -/** - * Client to a blob of any type: block, append, or page. It may only be instantiated through a {@link BlobClientBuilder} or via - * the method {@link ContainerClient#getBlobClient(String)}. This class does not hold any state about a particular - * blob, but is instead a convenient way of sending appropriate requests to the resource on the service. - * - *

- * This client offers the ability to download blobs. Note that uploading data is specific to each type of blob. Please - * refer to the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link AppendBlobClient} for upload options. This - * client can be converted into one of these clients easily through the methods {@link #asBlockBlobClient}, {@link #asPageBlobClient}, - * and {@link #asAppendBlobClient}. - * - *

- * This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, - * and operations on the service are available on {@link StorageClient}. - * - *

- * Please refer to the Azure Docs - * for more information. - */ -public class BlobClient { - - private BlobAsyncClient blobAsyncClient; - - /** - * Package-private constructor for use by {@link BlobClientBuilder}. - * @param azureBlobStorage the API client for blob storage API - */ - BlobClient(AzureBlobStorageImpl azureBlobStorage) { - this.blobAsyncClient = new BlobAsyncClient(azureBlobStorage); - } - - /** - * Static method for getting a new builder for this class. - * - * @return - * A new {@link BlobClientBuilder} instance. - */ - public static BlobClientBuilder blobClientBuilder() { - return new BlobClientBuilder(); - } - - /** - * Creates a new {@link BlockBlobClient} to this resource, maintaining configurations. Only do this for blobs - * that are known to be block blobs. - * - * @return - * A {@link BlockBlobClient} to this resource. - */ - public BlockBlobClient asBlockBlobClient() { - return new BlockBlobClient(this.blobAsyncClient.blobAsyncRawClient.azureBlobStorage); - } - - /** - * Creates a new {@link AppendBlobClient} to this resource, maintaining configurations. Only do this for blobs - * that are known to be append blobs. - * - * @return - * A {@link AppendBlobClient} to this resource. - */ - public AppendBlobClient asAppendBlobClient() { - return new AppendBlobClient(this.blobAsyncClient.blobAsyncRawClient.azureBlobStorage); - } - - /** - * Creates a new {@link PageBlobClient} to this resource, maintaining configurations. Only do this for blobs - * that are known to be page blobs. - * - * @return - * A {@link PageBlobClient} to this resource. - */ - public PageBlobClient asPageBlobClient() { - return new PageBlobClient(this.blobAsyncClient.blobAsyncRawClient.azureBlobStorage); - } - - /** - * Copies the data at the source URL to a blob. For more information, see the Azure Docs - * - * @param sourceURL - * The source URL to copy from. URLs outside of Azure may only be copied to block blobs. - * - * @return - * The copy ID for the long running operation. - */ - public String startCopyFromURL(URL sourceURL) { - return this.startCopyFromURL(sourceURL, null, null, null, null); - } - - /** - * Copies the data at the source URL to a blob. For more information, see the Azure Docs - * - * @param sourceURL - * The source URL to copy from. URLs outside of Azure may only be copied to block blobs. - * @param metadata - * {@link Metadata} - * @param sourceModifiedAccessConditions - * {@link ModifiedAccessConditions} against the source. Standard HTTP Access conditions related to the - * modification of data. ETag and LastModifiedTime are used to construct conditions related to when the blob - * was changed relative to the given request. The request will fail if the specified condition is not - * satisfied. - * @param destAccessConditions - * {@link BlobAccessConditions} against the destination. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The copy ID for the long running operation. - */ - public String startCopyFromURL(URL sourceURL, Metadata metadata, - ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, - Duration timeout) { - Mono response = blobAsyncClient - .startCopyFromURL(sourceURL, metadata, sourceModifiedAccessConditions, destAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. - * - * @param copyId - * The id of the copy operation to abort. Returned as the {@code copyId} field on the {@link - * BlobStartCopyFromURLHeaders} object. - */ - public void abortCopyFromURL(String copyId) { - this.abortCopyFromURL(copyId, null, null); - } - - /** - * Stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. - * - * @param copyId - * The id of the copy operation to abort. Returned as the {@code copyId} field on the {@link - * BlobStartCopyFromURLHeaders} object. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - */ - public void abortCopyFromURL(String copyId, LeaseAccessConditions leaseAccessConditions, Duration timeout) { - Mono response = blobAsyncClient - .abortCopyFromURL(copyId, leaseAccessConditions, null /*context*/); - - if (timeout == null) { - response.block(); - } else { - response.block(timeout); - } - } - - /** - * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. - * - * @param copySource - * The source URL to copy from. - * - * @return - * The copy ID for the long running operation. - */ - public String copyFromURL(URL copySource) { - return this.copyFromURL(copySource, null, null, null, null); - } - - /** - * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. - * - * @param copySource - * The source URL to copy from. URLs outside of Azure may only be copied to block blobs. - * @param metadata - * {@link Metadata} - * @param sourceModifiedAccessConditions - * {@link ModifiedAccessConditions} against the source. Standard HTTP Access conditions related to the - * modification of data. ETag and LastModifiedTime are used to construct conditions related to when the blob - * was changed relative to the given request. The request will fail if the specified condition is not - * satisfied. - * @param destAccessConditions - * {@link BlobAccessConditions} against the destination. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The copy ID for the long running operation. - */ - public String copyFromURL(URL copySource, Metadata metadata, - ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, - Duration timeout) { - Mono response = blobAsyncClient - .copyFromURL(copySource, metadata, sourceModifiedAccessConditions, destAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Downloads the entire blob into an output stream. Uploading data must be done from the {@link BlockBlobClient}, - * {@link PageBlobClient}, or {@link AppendBlobClient}. - * - * @param stream - * A non-null {@link OutputStream} instance where the downloaded data will be written. - */ - public void download(OutputStream stream) throws IOException { - this.download(stream, null, null, null, false, null); - } - - /** - * Downloads a range of bytes from a blob into an output stream. Uploading data must be done from the {@link BlockBlobClient}, - * {@link PageBlobClient}, or {@link AppendBlobClient}. - * - * @param stream - * A non-null {@link OutputStream} instance where the downloaded data will be written. - * @param range - * {@link BlobRange} - * @param accessConditions - * {@link BlobAccessConditions} - * @param rangeGetContentMD5 - * Whether the contentMD5 for the specified blob range should be returned. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - */ - public void download(OutputStream stream, ReliableDownloadOptions options, BlobRange range, - BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout) throws IOException { - Flux data = blobAsyncClient - .download(range, accessConditions, rangeGetContentMD5, options, null /*context*/); - - data = timeout == null - ? data - : data.timeout(timeout); //TODO this isn't doing what we want - - for (ByteBuffer buffer : data.toIterable()) { - stream.write(buffer.array()); - } - } - - /** - * Downloads the entire blob into a file specified by the path. The file will be created if it doesn't exist. - * Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link AppendBlobClient}. - * - * @param filePath - * A non-null {@link OutputStream} instance where the downloaded data will be written. - */ - public void downloadToFile(String filePath) throws IOException { - this.downloadToFile(filePath, null, null, null, false, null); - } - - /** - * Downloads a range of bytes blob into a file specified by the path. The file will be created if it doesn't exist. - * Uploading data must be done from the {@link BlockBlobClient}, {@link PageBlobClient}, or {@link AppendBlobClient}. - * - * @param filePath - * A non-null {@link OutputStream} instance where the downloaded data will be written. - * @param range - * {@link BlobRange} - * @param accessConditions - * {@link BlobAccessConditions} - * @param rangeGetContentMD5 - * Whether the contentMD5 for the specified blob range should be returned. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - */ - public void downloadToFile(String filePath, ReliableDownloadOptions options, BlobRange range, - BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout) throws IOException { - Mono download = blobAsyncClient.downloadToFile(filePath, range, accessConditions, rangeGetContentMD5, options, null); - - try { - if (timeout == null) { - download.block(); - } else { - download.block(timeout); //TODO this isn't doing what we want - } - } catch (UncheckedIOException e) { - throw e.getCause(); - } - } - - /** - * Deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. - */ - public void delete() { - this.delete(null, null, null); - } - - /** - * Deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. - * - * @param deleteBlobSnapshotOptions - * Specifies the behavior for deleting the snapshots on this blob. {@code Include} will delete the base blob - * and all snapshots. {@code Only} will delete only the snapshots. If a snapshot is being deleted, you must - * pass null. - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * A reactive response signalling completion. - */ - public void delete(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, - BlobAccessConditions accessConditions, Duration timeout) { - Mono response = blobAsyncClient - .delete(deleteBlobSnapshotOptions, accessConditions, null /*context*/); - - if (timeout == null) { - response.block(); - } else { - response.block(timeout); - } - } - - /** - * Returns the blob's metadata and properties. - * - * @return - * The blob properties and metadata. - */ - public BlobProperties getProperties() { - return this.getProperties(null, null); - } - - /** - * Returns the blob's metadata and properties. - * - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The blob properties and metadata. - */ - public BlobProperties getProperties(BlobAccessConditions accessConditions, Duration timeout) { - Mono response = blobAsyncClient - .getProperties(accessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Changes a blob's HTTP header properties. if only one HTTP header is updated, the - * others will all be erased. In order to preserve existing values, they must be - * passed alongside the header being changed. For more information, see the - * Azure Docs. - * - * @param headers - * {@link BlobHTTPHeaders} - */ - public void setHTTPHeaders(BlobHTTPHeaders headers) { - this.setHTTPHeaders(headers, null, null); - } - - /** - * Changes a blob's HTTP header properties. if only one HTTP header is updated, the - * others will all be erased. In order to preserve existing values, they must be - * passed alongside the header being changed. For more information, see the - * Azure Docs. - * - * @param headers - * {@link BlobHTTPHeaders} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - */ - public void setHTTPHeaders(BlobHTTPHeaders headers, BlobAccessConditions accessConditions, - Duration timeout) { - Mono response = blobAsyncClient - .setHTTPHeaders(headers, accessConditions, null /*context*/); - - if (timeout == null) { - response.block(); - } else { - response.block(timeout); - } - } - - /** - * Changes a blob's metadata. The specified metadata in this method will replace existing - * metadata. If old values must be preserved, they must be downloaded and included in the - * call to this method. For more information, see the Azure Docs. - * - * @param metadata - * {@link Metadata} - */ - public void setMetadata(Metadata metadata) { - this.setMetadata(metadata, null, null); - } - - /** - * Changes a blob's metadata. The specified metadata in this method will replace existing - * metadata. If old values must be preserved, they must be downloaded and included in the - * call to this method. For more information, see the Azure Docs. - * - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - */ - public void setMetadata(Metadata metadata, BlobAccessConditions accessConditions, Duration timeout) { - Mono response = blobAsyncClient - .setMetadata(metadata, accessConditions, null /*context*/); - - if (timeout == null) { - response.block(); - } else { - response.block(timeout); - } - } - - /** - * Creates a read-only snapshot of a blob. - * - * @return - * The ID of the new snapshot. - */ - public String createSnapshot() { - return this.createSnapshot(null, null, null); - } - - /** - * Creates a read-only snapshot of a blob. - * - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The ID of the new snapshot. - */ - public String createSnapshot(Metadata metadata, BlobAccessConditions accessConditions, Duration timeout) { - Mono response = blobAsyncClient - .createSnapshot(metadata, accessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Sets the tier on a blob. The operation is allowed on a page blob in a premium storage account or a block blob in - * a blob storage or GPV2 account. A premium page blob's tier determines the allowed size, IOPS, and bandwidth of - * the blob. A block blob's tier determines the Hot/Cool/Archive storage type. This does not update the blob's etag. - * - * @param tier - * The new tier for the blob. - */ - public void setTier(AccessTier tier) { - this.setTier(tier, null, null); - } - - /** - * Sets the tier on a blob. The operation is allowed on a page blob in a premium storage account or a block blob in - * a blob storage or GPV2 account. A premium page blob's tier determines the allowed size, IOPS, and bandwidth of - * the blob. A block blob's tier determines the Hot/Cool/Archive storage type. This does not update the blob's etag. - * - * @param tier - * The new tier for the blob. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - */ - public void setTier(AccessTier tier, LeaseAccessConditions leaseAccessConditions, Duration timeout) { - Mono response = blobAsyncClient - .setTier(tier, leaseAccessConditions, null /*context*/); - - if (timeout == null) { - response.block(); - } else { - response.block(timeout); - } - } - - /** - * Undelete restores the content and metadata of a soft-deleted blob and/or any associated soft-deleted snapshots. - */ - public void undelete() { - this.undelete(null); - } - - /** - * Undelete restores the content and metadata of a soft-deleted blob and/or any associated soft-deleted snapshots. - * - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - */ - public void undelete(Duration timeout) { - Mono response = blobAsyncClient - .undelete(null /*context*/); - - if (timeout == null) { - response.block(); - } else { - response.block(timeout); - } - } - - /** - * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 - * seconds, or infinite (-1). - * - * @param proposedId - * A {@code String} in any valid GUID format. May be null. - * @param duration - * The duration of the lease, in seconds, or negative one (-1) for a lease that - * never expires. A non-infinite lease can be between 15 and 60 seconds. - * - * @return - * The lease ID. - */ - public String acquireLease(String proposedId, int duration) { - return this.acquireLease(proposedId, duration, null, null); - } - - /** - * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 - * seconds, or infinite (-1). - * - * @param proposedID - * A {@code String} in any valid GUID format. May be null. - * @param duration - * The duration of the lease, in seconds, or negative one (-1) for a lease that - * never expires. A non-infinite lease can be between 15 and 60 seconds. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The lease ID. - */ - public String acquireLease(String proposedID, int duration, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono response = blobAsyncClient - .acquireLease(proposedID, duration, modifiedAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Renews the blob's previously-acquired lease. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * - * @return - * The renewed lease ID. - */ - public String renewLease(String leaseID) { - return this.renewLease(leaseID, null, null); - } - - /** - * Renews the blob's previously-acquired lease. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The renewed lease ID. - */ - public String renewLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions, - Duration timeout) { - Mono response = blobAsyncClient - .renewLease(leaseID, modifiedAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Releases the blob's previously-acquired lease. - * - * @param leaseID - * The leaseId of the active lease on the blob. - */ - public void releaseLease(String leaseID) { - this.releaseLease(leaseID, null, null); - } - - /** - * Releases the blob's previously-acquired lease. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - */ - public void releaseLease(String leaseID, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono response = blobAsyncClient - .releaseLease(leaseID, modifiedAccessConditions, null /*context*/); - - if (timeout == null) { - response.block(); - } else { - response.block(timeout); - } - } - - /** - * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant - * to break a fixed-duration lease when it expires or an infinite lease immediately. - * - * @return - * The remaining time in the broken lease in seconds. - */ - public int breakLease() { - return this.breakLease(null, null, null); - } - - /** - * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant - * to break a fixed-duration lease when it expires or an infinite lease immediately. - * - * @param breakPeriodInSeconds - * An optional {@code Integer} representing the proposed duration of seconds that the lease should continue - * before it is broken, between 0 and 60 seconds. This break period is only used if it is shorter than the - * time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be - * available before the break period has expired, but the lease may be held for longer than the break - * period. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The remaining time in the broken lease in seconds. - */ - public int breakLease(Integer breakPeriodInSeconds, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono response = blobAsyncClient - .breakLease(breakPeriodInSeconds, modifiedAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * ChangeLease changes the blob's lease ID. - * - * @param leaseId - * The leaseId of the active lease on the blob. - * @param proposedID - * A {@code String} in any valid GUID format. - * - * @return - * The new lease ID. - */ - public String changeLease(String leaseId, String proposedID) { - return this.changeLease(leaseId, proposedID, null, null); - } - - /** - * ChangeLease changes the blob's lease ID. For more information, see the Azure Docs. - * - * @param leaseId - * The leaseId of the active lease on the blob. - * @param proposedID - * A {@code String} in any valid GUID format. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return The new lease ID. - */ - public String changeLease(String leaseId, String proposedID, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono response = blobAsyncClient - .changeLease(leaseId, proposedID, modifiedAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the Azure Docs. - * - * @return The sku name and account kind. - */ - public StorageAccountInfo getAccountInfo() { - return this.getAccountInfo(null); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the Azure Docs. - * - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return The sku name and account kind. - */ - public StorageAccountInfo getAccountInfo(Duration timeout) { - Mono response = blobAsyncClient - .getAccountInfo(null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlobClientBuilder.java b/storage/client/src/main/java/com/azure/storage/blob/BlobClientBuilder.java deleted file mode 100644 index 67a0b10ff9f88..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/BlobClientBuilder.java +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.util.configuration.Configuration; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLoggingPolicy; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.implementation.util.ImplUtils; -import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * Fluent BlobClientBuilder for instantiating a {@link BlobClient} or {@link BlobAsyncClient}. - * - *

- * An instance of this builder may only be created from static method {@link BlobClient#blobClientBuilder()}. - * The following information must be provided on this builder: - * - *

    - *
  • the endpoint through {@code .endpoint()}, including the container name and blob name, in the format of {@code https://{accountName}.blob.core.windows.net/{containerName}/{blobName}}. - *
  • the credential through {@code .credentials()} or {@code .connectionString()} if the container is not publicly accessible. - *
- * - *

- * Once all the configurations are set on this builder, call {@code .buildClient()} to create a - * {@link BlobClient} or {@code .buildAsyncClient()} to create a {@link BlobAsyncClient}. - */ -public final class BlobClientBuilder { - private static final String ACCOUNT_NAME = "AccountName".toLowerCase(); - private static final String ACCOUNT_KEY = "AccountKey".toLowerCase(); - - private final List policies; - - private URL endpoint; - private ICredentials credentials = new AnonymousCredentials(); - private HttpClient httpClient; - private HttpLogDetailLevel logLevel; - private RetryPolicy retryPolicy; - private Configuration configuration; - - public BlobClientBuilder() { - retryPolicy = new RetryPolicy(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); - } - - /** - * Constructs an instance of BlobAsyncClient based on the configurations stored in the appendBlobClientBuilder. - * @return a new client instance - */ - private AzureBlobStorageImpl buildImpl() { - Objects.requireNonNull(endpoint); - - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - policies.add(new UserAgentPolicy(BlobConfiguration.NAME, BlobConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - policies.add(credentials); // This needs to be a different credential type. - - policies.add(retryPolicy); - - policies.addAll(this.policies); - policies.add(new HttpLoggingPolicy(logLevel)); - - HttpPipeline pipeline = HttpPipeline.builder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); - - return new AzureBlobStorageBuilder() - .url(endpoint.toString()) - .pipeline(pipeline) - .build(); - } - - /** - * @return a {@link BlobClient} created from the configurations in this builder. - */ - public BlobClient buildClient() { - return new BlobClient(buildImpl()); - } - - /** - * @return a {@link BlobAsyncClient} created from the configurations in this builder. - */ - public BlobAsyncClient buildAsyncClient() { - return new BlobAsyncClient(buildImpl()); - } - - /** - * Sets the service endpoint, additionally parses it for information (SAS token, container name, blob name) - * @param endpoint URL of the service - * @return the updated BlobClientBuilder object - */ - public BlobClientBuilder endpoint(String endpoint) { - Objects.requireNonNull(endpoint); - try { - this.endpoint = new URL(endpoint); - } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage Queue endpoint url is malformed."); - } - - return this; - } - - /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials - * @return the updated BlobClientBuilder object - */ - public BlobClientBuilder credentials(SharedKeyCredentials credentials) { - this.credentials = credentials; - return this; - } - - /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials - * @return the updated BlobClientBuilder object - */ - public BlobClientBuilder credentials(TokenCredentials credentials) { - this.credentials = credentials; - return this; - } - - /** - * Clears the credentials used to authorize requests sent to the service - * @return the updated BlobClientBuilder object - */ - public BlobClientBuilder anonymousCredentials() { - this.credentials = new AnonymousCredentials(); - return this; - } - - /** - * Sets the connection string for the service, parses it for authentication information (account name, account key) - * @param connectionString connection string from access keys section - * @return the updated BlobClientBuilder object - */ - public BlobClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - - Map connectionKVPs = new HashMap<>(); - for (String s : connectionString.split(";")) { - String[] kvp = s.split("=", 2); - connectionKVPs.put(kvp[0].toLowerCase(), kvp[1]); - } - - String accountName = connectionKVPs.get(ACCOUNT_NAME); - String accountKey = connectionKVPs.get(ACCOUNT_KEY); - - if (ImplUtils.isNullOrEmpty(accountName) || ImplUtils.isNullOrEmpty(accountKey)) { - throw new IllegalArgumentException("Connection string must contain 'AccountName' and 'AccountKey'."); - } - - // Use accountName and accountKey to get the SAS token using the credential class. - credentials = new SharedKeyCredentials(accountName, accountKey); - - return this; - } - - /** - * Sets the http client used to send service requests - * @param httpClient http client to send requests - * @return the updated BlobClientBuilder object - */ - public BlobClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /** - * Adds a pipeline policy to apply on each request sent - * @param pipelinePolicy a pipeline policy - * @return the updated BlobClientBuilder object - */ - public BlobClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - this.policies.add(pipelinePolicy); - return this; - } - - /** - * Sets the logging level for service requests - * @param logLevel logging level - * @return the updated BlobClientBuilder object - */ - public BlobClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { - this.logLevel = logLevel; - return this; - } - - /** - * Sets the configuration object used to retrieve environment configuration values used to buildClient the client with - * when they are not set in the appendBlobClientBuilder, defaults to Configuration.NONE - * @param configuration configuration store - * @return the updated BlobClientBuilder object - */ - public BlobClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlobConfiguration.java b/storage/client/src/main/java/com/azure/storage/blob/BlobConfiguration.java deleted file mode 100644 index ae1e422a24c0a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/BlobConfiguration.java +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.storage.blob; - -class BlobConfiguration { - static final String NAME = "storage-blob"; - static final String VERSION = "1.0.0-SNAPSHOT"; -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlobListDetails.java b/storage/client/src/main/java/com/azure/storage/blob/BlobListDetails.java deleted file mode 100644 index 445bb567f7823..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/BlobListDetails.java +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.storage.blob.models.ListBlobsIncludeItem; - -import java.util.ArrayList; - -/** - * This type allows users to specify additional information the service should return with each blob when listing blobs - * in a container (via a {@link ContainerURL} object). This type is immutable to ensure thread-safety of requests, so - * changing the details for a different listing operation requires construction of a new object. Null may be passed if - * none of the options are desirable. - */ -public final class BlobListDetails { - - private boolean copy; - - private boolean metadata; - - private boolean snapshots; - - private boolean uncommittedBlobs; - - private boolean deletedBlobs; - - public BlobListDetails() { - } - - /** - * Whether blob metadata related to any current or previous Copy Blob operation should be included in the - * response. - */ - public boolean copy() { - return copy; - } - - /** - * Whether blob metadata related to any current or previous Copy Blob operation should be included in the - * response. - */ - public BlobListDetails withCopy(boolean copy) { - this.copy = copy; - return this; - } - - /** - * Whether blob metadata should be returned. - */ - public boolean metadata() { - return metadata; - } - - /** - * Whether blob metadata should be returned. - */ - public BlobListDetails withMetadata(boolean metadata) { - this.metadata = metadata; - return this; - } - - /** - * Whether snapshots should be returned. Snapshots are listed from oldest to newest. - */ - public boolean snapshots() { - return snapshots; - } - - /** - * Whether snapshots should be returned. Snapshots are listed from oldest to newest. - */ - public BlobListDetails withSnapshots(boolean snapshots) { - this.snapshots = snapshots; - return this; - } - - /** - * Whether blobs for which blocks have been uploaded, but which have not been committed using Put Block List, - * should be included in the response. - */ - public boolean uncommittedBlobs() { - return uncommittedBlobs; - } - - /** - * Whether blobs for which blocks have been uploaded, but which have not been committed using Put Block List, - * should be included in the response. - */ - public BlobListDetails withUncommittedBlobs(boolean uncommittedBlobs) { - this.uncommittedBlobs = uncommittedBlobs; - return this; - } - - /** - * Whether blobs which have been soft deleted should be returned. - */ - public boolean deletedBlobs() { - return deletedBlobs; - } - - /** - * Whether blobs which have been soft deleted should be returned. - */ - public BlobListDetails withDeletedBlobs(boolean deletedBlobs) { - this.deletedBlobs = deletedBlobs; - return this; - } - - /* - This is used internally to convert the details structure into a list to pass to the protocol layer. The customer - should never have need for this. - */ - ArrayList toList() { - ArrayList details = new ArrayList(); - if (this.copy) { - details.add(ListBlobsIncludeItem.COPY); - } - if (this.deletedBlobs) { - details.add(ListBlobsIncludeItem.DELETED); - } - if (this.metadata) { - details.add(ListBlobsIncludeItem.METADATA); - } - if (this.snapshots) { - details.add(ListBlobsIncludeItem.SNAPSHOTS); - } - if (this.uncommittedBlobs) { - details.add(ListBlobsIncludeItem.UNCOMMITTEDBLOBS); - } - return details; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlobProperties.java b/storage/client/src/main/java/com/azure/storage/blob/BlobProperties.java deleted file mode 100644 index ad5026cd63f35..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/BlobProperties.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.azure.storage.blob; - -import com.azure.storage.blob.models.BlobGetPropertiesHeaders; -import com.azure.storage.blob.models.BlobType; - -public class BlobProperties { - - private final BlobType blobType; - - private final Metadata metadata; - - private final long blobSize; - - private final byte[] contentMD5; - - private final String contentEncoding; - - private final String contentDisposition; - - private final String contentLanguage; - - private final String cacheControl; - - //todo decide datetime representation for last modified time - - - BlobProperties(BlobGetPropertiesHeaders generatedHeaders) { - this.blobType = generatedHeaders.blobType(); - this.metadata = new Metadata(generatedHeaders.metadata()); - this.blobSize = generatedHeaders.contentLength(); - this.contentMD5 = generatedHeaders.contentMD5(); - this.contentEncoding = generatedHeaders.contentEncoding(); - this.contentDisposition = generatedHeaders.contentDisposition(); - this.contentLanguage = generatedHeaders.contentLanguage(); - this.cacheControl = generatedHeaders.cacheControl(); - } - - - public BlobType blobType() { - return blobType; - } - - public Metadata metadata() { - return metadata; - } - - public long blobSize() { - return blobSize; - } - - public byte[] contentMD5() { - return contentMD5; - } - - public String contentEncoding() { - return contentEncoding; - } - - public String contentDisposition() { - return contentDisposition; - } - - public String contentLanguage() { - return contentLanguage; - } - - public String cacheControl() { - return cacheControl; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlobRange.java b/storage/client/src/main/java/com/azure/storage/blob/BlobRange.java deleted file mode 100644 index 054f9f1a1b782..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/BlobRange.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import java.util.Locale; - -/** - * This is a representation of a range of bytes on a blob, typically used during a download operation. This type is - * immutable to ensure thread-safety of requests, so changing the values for a different operation requires construction - * of a new object. Passing null as a BlobRange value will default to the entire range of the blob. - */ -public final class BlobRange { - - private long offset; - private Long count; - - /** - * Specifies the download operation to start from the offset position (zero-based) and download the - * rest of the entire blob to the end. - * - * @param offset - * the zero-based position to start downloading - */ - public BlobRange(long offset) { - if (offset < 0) { - throw new IllegalArgumentException("BlobRange offset must be greater than or equal to 0."); - } - this.offset = offset; - } - - /** - * Specifies the download operation to start from the offset position (zero-based) and download the - * count number of bytes. - * - * @param offset - * the zero-based position to start downloading - * @param count - * the number of bytes to download - */ - public BlobRange(long offset, long count) { - this(offset); - if (count < 0) { - throw new IllegalArgumentException( - "BlobRange count must be greater than or equal to 0 if specified."); - } - this.count = count; - } - - /** - * The start of the range. Must be greater than or equal to 0. - */ - public long offset() { - return offset; - } - - /** - * How many bytes to include in the range. Must be greater than or equal to 0 if specified. - */ - public Long count() { - return count; - } - - /** - * @return A {@code String} compliant with the format of the Azure Storage x-ms-range and Range headers. - */ - @Override - public String toString() { - if (this.count != null) { - long rangeEnd = this.offset + this.count - 1; - return String.format( - Locale.ROOT, Constants.HeaderConstants.RANGE_HEADER_FORMAT, this.offset, rangeEnd); - } - - return String.format( - Locale.ROOT, Constants.HeaderConstants.BEGIN_RANGE_HEADER_FORMAT, this.offset); - } - - /* - In the case where the customer passes a null BlobRange, constructing the default of "0-" will fail on an empty blob. - By returning null as the header value, we elect not to set the header, which has the same effect, namely downloading - the whole blob, but it will not fail in the empty case. - */ - String toHeaderValue() { - // The default values of a BlobRange - if (this.offset == 0 && this.count == null) { - return null; - } - return this.toString(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlobRawClient.java b/storage/client/src/main/java/com/azure/storage/blob/BlobRawClient.java deleted file mode 100644 index 58f48d3454b1f..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/BlobRawClient.java +++ /dev/null @@ -1,768 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.AccessTier; -import com.azure.storage.blob.models.BlobHTTPHeaders; -import com.azure.storage.blob.models.BlobStartCopyFromURLHeaders; -import com.azure.storage.blob.models.BlobsAbortCopyFromURLResponse; -import com.azure.storage.blob.models.BlobsAcquireLeaseResponse; -import com.azure.storage.blob.models.BlobsBreakLeaseResponse; -import com.azure.storage.blob.models.BlobsChangeLeaseResponse; -import com.azure.storage.blob.models.BlobsCopyFromURLResponse; -import com.azure.storage.blob.models.BlobsCreateSnapshotResponse; -import com.azure.storage.blob.models.BlobsDeleteResponse; -import com.azure.storage.blob.models.BlobsGetAccountInfoResponse; -import com.azure.storage.blob.models.BlobsGetPropertiesResponse; -import com.azure.storage.blob.models.BlobsReleaseLeaseResponse; -import com.azure.storage.blob.models.BlobsRenewLeaseResponse; -import com.azure.storage.blob.models.BlobsSetHTTPHeadersResponse; -import com.azure.storage.blob.models.BlobsSetMetadataResponse; -import com.azure.storage.blob.models.BlobsSetTierResponse; -import com.azure.storage.blob.models.BlobsStartCopyFromURLResponse; -import com.azure.storage.blob.models.BlobsUndeleteResponse; -import com.azure.storage.blob.models.DeleteSnapshotsOptionType; -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.ModifiedAccessConditions; -import reactor.core.publisher.Mono; - -import java.io.IOException; -import java.io.OutputStream; -import java.net.URL; -import java.time.Duration; - -/** - * Represents a URL to a blob of any type: block, append, or page. It may be obtained by direct construction or via the - * create method on a {@link ContainerAsyncClient} object. This class does not hold any state about a particular blob but is - * instead a convenient way of sending off appropriate requests to the resource on the service. Please refer to the - * Azure Docs for more information. - */ -class BlobRawClient { - - private BlobAsyncRawClient blobAsyncRawClient; - - /** - * Creates a {@code BlobAsyncRawClient} object pointing to the account specified by the URL and using the provided pipeline to - * make HTTP requests. - */ - BlobRawClient(AzureBlobStorageImpl azureBlobStorage) { - this.blobAsyncRawClient = new BlobAsyncRawClient(azureBlobStorage); - } - - /** - * Copies the data at the source URL to a blob. For more information, see the Azure Docs - * - * @param sourceURL - * The source URL to copy from. URLs outside of Azure may only be copied to block blobs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=start_copy "Sample code for BlobAsyncRawClient.startCopyFromURL")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=start_copy_helper "Helper for start_copy sample.")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsStartCopyFromURLResponse startCopyFromURL(URL sourceURL) { - return this.startCopyFromURL(sourceURL, null, null, null, null); - } - - /** - * Copies the data at the source URL to a blob. For more information, see the Azure Docs - * - * @param sourceURL - * The source URL to copy from. URLs outside of Azure may only be copied to block blobs. - * @param metadata - * {@link Metadata} - * @param sourceModifiedAccessConditions - * {@link ModifiedAccessConditions} against the source. Standard HTTP Access conditions related to the - * modification of data. ETag and LastModifiedTime are used to construct conditions related to when the blob - * was changed relative to the given request. The request will fail if the specified condition is not - * satisfied. - * @param destAccessConditions - * {@link BlobAccessConditions} against the destination. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=start_copy "Sample code for BlobAsyncRawClient.startCopyFromURL")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=start_copy_helper "Helper for start_copy sample.")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsStartCopyFromURLResponse startCopyFromURL(URL sourceURL, Metadata metadata, - ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, - Duration timeout) { - Mono response = blobAsyncRawClient - .startCopyFromURL(sourceURL, metadata, sourceModifiedAccessConditions, destAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. For - * more information, see the Azure Docs. - * - * @param copyId - * The id of the copy operation to abort. Returned as the {@code copyId} field on the {@link - * BlobStartCopyFromURLHeaders} object. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=abort_copy "Sample code for BlobAsyncRawClient.abortCopyFromURL")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsAbortCopyFromURLResponse abortCopyFromURL(String copyId) { - return this.abortCopyFromURL(copyId, null, null); - } - - /** - * Stops a pending copy that was previously started and leaves a destination blob with 0 length and metadata. For - * more information, see the Azure Docs. - * - * @param copyId - * The id of the copy operation to abort. Returned as the {@code copyId} field on the {@link - * BlobStartCopyFromURLHeaders} object. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=abort_copy "Sample code for BlobAsyncRawClient.abortCopyFromURL")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsAbortCopyFromURLResponse abortCopyFromURL(String copyId, LeaseAccessConditions leaseAccessConditions, - Duration timeout) { - Mono response = blobAsyncRawClient - .abortCopyFromURL(copyId, leaseAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. - * For more information, see the Azure Docs - * - * @param copySource - * The source URL to copy from. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=sync_copy "Sample code for BlobAsyncRawClient.copyFromURL")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsCopyFromURLResponse syncCopyFromURL(URL copySource) { - return this.syncCopyFromURL(copySource, null, null, null, null); - } - - /** - * Copies the data at the source URL to a blob and waits for the copy to complete before returning a response. - * For more information, see the Azure Docs - * - * @param copySource - * The source URL to copy from. URLs outside of Azure may only be copied to block blobs. - * @param metadata - * {@link Metadata} - * @param sourceModifiedAccessConditions - * {@link ModifiedAccessConditions} against the source. Standard HTTP Access conditions related to the - * modification of data. ETag and LastModifiedTime are used to construct conditions related to when the blob - * was changed relative to the given request. The request will fail if the specified condition is not - * satisfied. - * @param destAccessConditions - * {@link BlobAccessConditions} against the destination. - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=sync_copy "Sample code for BlobAsyncRawClient.copyFromURL")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsCopyFromURLResponse syncCopyFromURL(URL copySource, Metadata metadata, - ModifiedAccessConditions sourceModifiedAccessConditions, BlobAccessConditions destAccessConditions, - Duration timeout) { - Mono response = blobAsyncRawClient - .syncCopyFromURL(copySource, metadata, sourceModifiedAccessConditions, destAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Reads a range of bytes from a blob. The response also includes the blob's properties and metadata. For more - * information, see the Azure Docs. - *

- * Note that the response body has reliable download functionality built in, meaning that a failed download stream - * will be automatically retried. This behavior may be configured with {@link ReliableDownloadOptions}. - * - * @return Emits the successful response. - * @apiNote ## Sample Code \n [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=upload_download - * "Sample code for BlobAsyncRawClient.download")] \n For more samples, please see the [Samples - * file](%https://github.com/Azure/azure-storage-java/blob/New-Storage-SDK-V10-Preview/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public void download(OutputStream stream) throws IOException { - this.download(stream, null, null, null, false, null); - } - - /** - * Reads a range of bytes from a blob. The response also includes the blob's properties and metadata. For more - * information, see the Azure Docs. - *

- * Note that the response body has reliable download functionality built in, meaning that a failed download stream - * will be automatically retried. This behavior may be configured with {@link ReliableDownloadOptions}. - * - * @param range - * {@link BlobRange} - * @param accessConditions - * {@link BlobAccessConditions} - * @param rangeGetContentMD5 - * Whether the contentMD5 for the specified blob range should be returned. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=upload_download "Sample code for BlobAsyncRawClient.download")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public void download(OutputStream stream, ReliableDownloadOptions options, BlobRange range, - BlobAccessConditions accessConditions, boolean rangeGetContentMD5, Duration timeout) throws IOException { - Mono response = blobAsyncRawClient - .download(range, accessConditions, rangeGetContentMD5, null /*context*/); - - DownloadResponse download = new DownloadResponse(timeout == null - ? response.block() - : response.block(timeout)); - - download.body(stream, options); - } - - /** - * Deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. For more - * information, see the Azure Docs. - * - * @return Emits the successful response. - * @apiNote ## Sample Code \n [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_delete - * "Sample code for BlobAsyncRawClient.delete")] \n For more samples, please see the [Samples - * file](%https://github.com/Azure/azure-storage-java/blob/New-Storage-SDK-V10-Preview/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsDeleteResponse delete() { - return this.delete(null, null, null); - } - - /** - * Deletes the specified blob or snapshot. Note that deleting a blob also deletes all its snapshots. For more - * information, see the Azure Docs. - * - * @param deleteBlobSnapshotOptions - * Specifies the behavior for deleting the snapshots on this blob. {@code Include} will delete the base blob - * and all snapshots. {@code Only} will delete only the snapshots. If a snapshot is being deleted, you must - * pass null. - * @param accessConditions - * {@link BlobAccessConditions} - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_delete "Sample code for BlobAsyncRawClient.delete")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsDeleteResponse delete(DeleteSnapshotsOptionType deleteBlobSnapshotOptions, - BlobAccessConditions accessConditions, Duration timeout) { - Mono response = blobAsyncRawClient - .delete(deleteBlobSnapshotOptions, accessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Returns the blob's metadata and properties. For more information, see the Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=properties_metadata "Sample code for BlobAsyncRawClient.getProperties")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsGetPropertiesResponse getProperties() { - return this.getProperties(null, null); - } - - /** - * Returns the blob's metadata and properties. For more information, see the Azure Docs. - * - * @param accessConditions - * {@link BlobAccessConditions} - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=properties_metadata "Sample code for BlobAsyncRawClient.getProperties")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsGetPropertiesResponse getProperties(BlobAccessConditions accessConditions, Duration timeout) { - Mono response = blobAsyncRawClient - .getProperties(accessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Changes a blob's HTTP header properties. For more information, see the Azure - * Docs. - * - * @param headers - * {@link BlobHTTPHeaders} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=properties_metadata "Sample code for BlobAsyncRawClient.setHTTPHeaders")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsSetHTTPHeadersResponse setHTTPHeaders(BlobHTTPHeaders headers) { - return this.setHTTPHeaders(headers, null, null); - } - - /** - * Changes a blob's HTTP header properties. For more information, see the Azure Docs. - * - * @param headers - * {@link BlobHTTPHeaders} - * @param accessConditions - * {@link BlobAccessConditions} - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=properties_metadata "Sample code for BlobAsyncRawClient.setHTTPHeaders")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsSetHTTPHeadersResponse setHTTPHeaders(BlobHTTPHeaders headers, BlobAccessConditions accessConditions, - Duration timeout) { - Mono response = blobAsyncRawClient - .setHTTPHeaders(headers, accessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Changes a blob's metadata. For more information, see the Azure Docs. - * - * @param metadata - * {@link Metadata} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=properties_metadata "Sample code for BlobAsyncRawClient.setMetadata")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsSetMetadataResponse setMetadata(Metadata metadata) { - return this.setMetadata(metadata, null, null); - } - - /** - * Changes a blob's metadata. For more information, see the Azure Docs. - * - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=properties_metadata "Sample code for BlobAsyncRawClient.setMetadata")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsSetMetadataResponse setMetadata(Metadata metadata, BlobAccessConditions accessConditions, - Duration timeout) { - Mono response = blobAsyncRawClient - .setMetadata(metadata, accessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Creates a read-only snapshot of a blob. For more information, see the Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=snapshot "Sample code for BlobAsyncRawClient.createSnapshot")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsCreateSnapshotResponse createSnapshot() { - return this.createSnapshot(null, null, null); - } - - /** - * Creates a read-only snapshot of a blob. For more information, see the Azure Docs. - * - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=snapshot "Sample code for BlobAsyncRawClient.createSnapshot")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsCreateSnapshotResponse createSnapshot(Metadata metadata, BlobAccessConditions accessConditions, - Duration timeout) { - Mono response = blobAsyncRawClient - .createSnapshot(metadata, accessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Sets the tier on a blob. The operation is allowed on a page blob in a premium storage account or a block blob in - * a blob storage or GPV2 account. A premium page blob's tier determines the allowed size, IOPS, and bandwidth of - * the blob. A block blob's tier determines the Hot/Cool/Archive storage type. This does not update the blob's etag. - *

- * For detailed information about block blob level tiering see the Azure Docs. - * - * @param tier - * The new tier for the blob. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=tier "Sample code for BlobAsyncRawClient.setTier")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsSetTierResponse setTier(AccessTier tier) { - return this.setTier(tier, null, null); - } - - /** - * Sets the tier on a blob. The operation is allowed on a page blob in a premium storage account or a block blob in - * a blob storage or GPV2 account. A premium page blob's tier determines the allowed size, IOPS, and bandwidth of - * the blob. A block blob's tier determines the Hot/Cool/Archive storage type. This does not update the blob's etag. - *

- * For detailed information about block blob level tiering see the Azure Docs. - * - * @param tier - * The new tier for the blob. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=tier "Sample code for BlobAsyncRawClient.setTier")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsSetTierResponse setTier(AccessTier tier, LeaseAccessConditions leaseAccessConditions, Duration timeout) { - Mono response = blobAsyncRawClient - .setTier(tier, leaseAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Undelete restores the content and metadata of a soft-deleted blob and/or any associated soft-deleted snapshots. - * For more information, see the Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=undelete "Sample code for BlobAsyncRawClient.undelete")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsUndeleteResponse undelete() { - return this.undelete(null); - } - - /** - * Undelete restores the content and metadata of a soft-deleted blob and/or any associated soft-deleted snapshots. - * For more information, see the Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=undelete "Sample code for BlobAsyncRawClient.undelete")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsUndeleteResponse undelete(Duration timeout) { - Mono response = blobAsyncRawClient - .undelete(null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 - * seconds, or infinite (-1). For more information, see the Azure Docs. - * - * @param proposedId - * A {@code String} in any valid GUID format. May be null. - * @param duration - * The duration of the lease, in seconds, or negative one (-1) for a lease that - * never expires. A non-infinite lease can be between 15 and 60 seconds. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.acquireLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsAcquireLeaseResponse acquireLease(String proposedId, int duration) { - return this.acquireLease(proposedId, duration, null, null); - } - - /** - * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 - * seconds, or infinite (-1). For more information, see the Azure Docs. - * - * @param proposedID - * A {@code String} in any valid GUID format. May be null. - * @param duration - * The duration of the lease, in seconds, or negative one (-1) for a lease that - * never expires. A non-infinite lease can be between 15 and 60 seconds. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.acquireLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsAcquireLeaseResponse acquireLease(String proposedID, int duration, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono response = blobAsyncRawClient - .acquireLease(proposedID, duration, modifiedAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Renews the blob's previously-acquired lease. For more information, see the Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.renewLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsRenewLeaseResponse renewLease(String leaseID) { - return this.renewLease(leaseID, null, null); - } - - /** - * Renews the blob's previously-acquired lease. For more information, see the Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.renewLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsRenewLeaseResponse renewLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions, - Duration timeout) { - Mono response = blobAsyncRawClient - .renewLease(leaseID, modifiedAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Releases the blob's previously-acquired lease. For more information, see the Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.releaseLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsReleaseLeaseResponse releaseLease(String leaseID) { - return this.releaseLease(leaseID, null, null); - } - - /** - * Releases the blob's previously-acquired lease. For more information, see the Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.releaseLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsReleaseLeaseResponse releaseLease(String leaseID, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono response = blobAsyncRawClient - .releaseLease(leaseID, modifiedAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant - * to break a fixed-duration lease when it expires or an infinite lease immediately. For more information, see the - * Azure Docs. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.breakLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/New-Storage-SDK-V10-Preview/src/test/java/com/microsoft/azure/storage/Samples.java) - * - * @return - * Emits the successful response. - */ - public BlobsBreakLeaseResponse breakLease() { - return this.breakLease(null, null, null); - } - - /** - * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant - * to break a fixed-duration lease when it expires or an infinite lease immediately. For more information, see the - * Azure Docs. - * - * @param breakPeriodInSeconds - * An optional {@code Integer} representing the proposed duration of seconds that the lease should continue - * before it is broken, between 0 and 60 seconds. This break period is only used if it is shorter than the - * time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be - * available before the break period has expired, but the lease may be held for longer than the break - * period. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.breakLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsBreakLeaseResponse breakLease(Integer breakPeriodInSeconds, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono response = blobAsyncRawClient - .breakLease(breakPeriodInSeconds, modifiedAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * ChangeLease changes the blob's lease ID. For more information, see the Azure Docs. - * - * @param leaseId - * The leaseId of the active lease on the blob. - * @param proposedID - * A {@code String} in any valid GUID format. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.changeLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsChangeLeaseResponse changeLease(String leaseId, String proposedID) { - return this.changeLease(leaseId, proposedID, null, null); - } - - /** - * ChangeLease changes the blob's lease ID. For more information, see the Azure Docs. - * - * @param leaseId - * The leaseId of the active lease on the blob. - * @param proposedID - * A {@code String} in any valid GUID format. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blob_lease "Sample code for BlobAsyncRawClient.changeLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsChangeLeaseResponse changeLease(String leaseId, String proposedID, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono response = blobAsyncRawClient - .changeLease(leaseId, proposedID, modifiedAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=account_info "Sample code for BlobAsyncRawClient.getAccountInfo")] \n - * For more samples, please see the [Samples file](https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsGetAccountInfoResponse getAccountInfo() { - return this.getAccountInfo(null); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=account_info "Sample code for BlobAsyncRawClient.getAccountInfo")] \n - * For more samples, please see the [Samples file](https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlobsGetAccountInfoResponse getAccountInfo(Duration timeout) { - Mono response = blobAsyncRawClient - .getAccountInfo(null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlobSASPermission.java b/storage/client/src/main/java/com/azure/storage/blob/BlobSASPermission.java deleted file mode 100644 index 3a7c747b2fc77..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/BlobSASPermission.java +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import java.util.Locale; - -/** - * This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a blob. Setting - * a value to true means that any SAS which uses these permissions will grant permissions for that operation. Once all - * the values are set, this should be serialized with toString and set as the permissions field on a - * {@link ServiceSASSignatureValues} object. It is possible to construct the permissions string without this class, but - * the order of the permissions is particular and this class guarantees correctness. - */ -final class BlobSASPermission { - - private boolean read; - - private boolean add; - - private boolean create; - - private boolean write; - - private boolean delete; - - /** - * Initializes a {@code BlobSASPermission} object with all fields set to false. - */ - public BlobSASPermission() { - } - - /** - * Creates a {@code BlobSASPermission} from the specified permissions string. This method will throw an - * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. - * - * @param permString - * A {@code String} which represents the {@code BlobSASPermission}. - * - * @return A {@code BlobSASPermission} generated from the given {@code String}. - */ - public static BlobSASPermission parse(String permString) { - BlobSASPermission permissions = new BlobSASPermission(); - - for (int i = 0; i < permString.length(); i++) { - char c = permString.charAt(i); - switch (c) { - case 'r': - permissions.read = true; - break; - case 'a': - permissions.add = true; - break; - case 'c': - permissions.create = true; - break; - case 'w': - permissions.write = true; - break; - case 'd': - permissions.delete = true; - break; - default: - throw new IllegalArgumentException( - String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, "Permissions", permString, c)); - } - } - return permissions; - } - - /** - * Specifies Read access granted. - */ - public boolean read() { - return read; - } - - /** - * Specifies Read access granted. - */ - public BlobSASPermission withRead(boolean read) { - this.read = read; - return this; - } - - /** - * Specifies Add access granted. - */ - public boolean add() { - return add; - } - - /** - * Specifies Add access granted. - */ - public BlobSASPermission withAdd(boolean add) { - this.add = add; - return this; - } - - /** - * Specifies Create access granted. - */ - public boolean create() { - return create; - } - - /** - * Specifies Create access granted. - */ - public BlobSASPermission withCreate(boolean create) { - this.create = create; - return this; - } - - /** - * Specifies Write access granted. - */ - public boolean write() { - return write; - } - - /** - * Specifies Write access granted. - */ - public BlobSASPermission withWrite(boolean write) { - this.write = write; - return this; - } - - /** - * Specifies Delete access granted. - */ - public boolean delete() { - return delete; - } - - /** - * Specifies Delete access granted. - */ - public BlobSASPermission withDelete(boolean delete) { - this.delete = delete; - return this; - } - - /** - * Converts the given permissions to a {@code String}. Using this method will guarantee the permissions are in an - * order accepted by the service. - * - * @return A {@code String} which represents the {@code BlobSASPermission}. - */ - @Override - public String toString() { - // The order of the characters should be as specified here to ensure correctness: - // https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas - - final StringBuilder builder = new StringBuilder(); - - if (this.read) { - builder.append('r'); - } - - if (this.add) { - builder.append('a'); - } - - if (this.create) { - builder.append('c'); - } - - if (this.write) { - builder.append('w'); - } - - if (this.delete) { - builder.append('d'); - } - - return builder.toString(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlobURLParts.java b/storage/client/src/main/java/com/azure/storage/blob/BlobURLParts.java deleted file mode 100644 index 7be9aee95b45e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/BlobURLParts.java +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.implementation.http.UrlBuilder; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; - -/** - * A BlobURLParts object represents the components that make up an Azure Storage Container/Blob URL. You may parse an - * existing URL into its parts with the {@link URLParser} class. You may construct a URL from parts by calling toURL(). - * It is also possible to use the empty constructor to buildClient a blobURL from scratch. - * NOTE: Changing any SAS-related field requires computing a new SAS signature. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=url_parts "Sample code for BlobURLParts")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ -final class BlobURLParts { - - private String scheme; - - private String host; - - private String containerName; - - private String blobName; - - private String snapshot; - - private SASQueryParameters sasQueryParameters; - - private Map unparsedParameters; - - /** - * Initializes a BlobURLParts object with all fields set to null, except unparsedParameters, which is an empty map. - * This may be useful for constructing a URL to a blob storage resource from scratch when the constituent parts are - * already known. - */ - public BlobURLParts() { - unparsedParameters = new HashMap<>(); - } - - /** - * The scheme. Ex: "https://". - */ - public String scheme() { - return scheme; - } - - /** - * The scheme. Ex: "https://". - */ - public BlobURLParts withScheme(String scheme) { - this.scheme = scheme; - return this; - } - - /** - * The host. Ex: "account.blob.core.windows.net". - */ - public String host() { - return host; - } - - /** - * The host. Ex: "account.blob.core.windows.net". - */ - public BlobURLParts withHost(String host) { - this.host = host; - return this; - } - - /** - * The container name or {@code null} if a {@link StorageAsyncRawClient} was parsed. - */ - public String containerName() { - return containerName; - } - - /** - * The container name or {@code null} if a {@link StorageAsyncRawClient} was parsed. - */ - public BlobURLParts withContainerName(String containerName) { - this.containerName = containerName; - return this; - } - - /** - * The blob name or {@code null} if a {@link StorageAsyncRawClient} or {@link ContainerAsyncClient} was parsed. - */ - public String blobName() { - return blobName; - } - - /** - * The blob name or {@code null} if a {@link StorageAsyncRawClient} or {@link ContainerAsyncClient} was parsed. - */ - public BlobURLParts withBlobName(String blobName) { - this.blobName = blobName; - return this; - } - - /** - * The snapshot time or {@code null} if anything except a URL to a snapshot was parsed. - */ - public String snapshot() { - return snapshot; - } - - /** - * The snapshot time or {@code null} if anything except a URL to a snapshot was parsed. - */ - public BlobURLParts withSnapshot(String snapshot) { - this.snapshot = snapshot; - return this; - } - - /** - * A {@link SASQueryParameters} representing the SAS query parameters or {@code null} if there were no such - * parameters. - */ - public SASQueryParameters sasQueryParameters() { - return sasQueryParameters; - } - - /** - * A {@link SASQueryParameters} representing the SAS query parameters or {@code null} if there were no such - * parameters. - */ - public BlobURLParts withSasQueryParameters(SASQueryParameters sasQueryParameters) { - this.sasQueryParameters = sasQueryParameters; - return this; - } - - /** - * The query parameter key value pairs aside from SAS parameters and snapshot time or {@code null} if there were - * no such parameters. - */ - public Map unparsedParameters() { - return unparsedParameters; - } - - /** - * The query parameter key value pairs aside from SAS parameters and snapshot time or {@code null} if there were - * no such parameters. - */ - public BlobURLParts withUnparsedParameters(Map unparsedParameters) { - this.unparsedParameters = unparsedParameters; - return this; - } - - /** - * Converts the blob URL parts to a {@link URL}. - * - * @return A {@code java.net.URL} to the blob resource composed of all the elements in the object. - * - * @throws MalformedURLException - * The fields present on the BlobURLParts object were insufficient to construct a valid URL or were - * ill-formatted. - */ - public URL toURL() throws MalformedURLException { - UrlBuilder url = new UrlBuilder().scheme(this.scheme).host(this.host); - - StringBuilder path = new StringBuilder(); - if (this.containerName != null) { - path.append(this.containerName); - if (this.blobName != null) { - path.append('/'); - path.append(this.blobName); - } - } - url.path(path.toString()); - - if (this.snapshot != null) { - url.setQueryParameter(Constants.SNAPSHOT_QUERY_PARAMETER, this.snapshot); - } - if (this.sasQueryParameters != null) { - String encodedSAS = this.sasQueryParameters.encode(); - if (encodedSAS.length() != 0) { - url.query(encodedSAS); - } - } - - for (Map.Entry entry : this.unparsedParameters.entrySet()) { - // The commas are intentionally encoded. - url.setQueryParameter(entry.getKey(), - Utility.safeURLEncode(String.join(",", entry.getValue()))); - } - - return url.toURL(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java b/storage/client/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java deleted file mode 100644 index 617a8be812299..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/BlockBlobAsyncClient.java +++ /dev/null @@ -1,395 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.rest.ResponseBase; -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.BlobHTTPHeaders; -import com.azure.storage.blob.models.BlockItem; -import com.azure.storage.blob.models.BlockListType; -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.SourceModifiedAccessConditions; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.netty.ByteBufFlux; - -import java.io.File; -import java.net.URL; -import java.nio.ByteBuffer; -import java.nio.file.Paths; -import java.util.List; - -/** - * Client to a block blob. It may only be instantiated through a {@link BlockBlobClientBuilder}, via - * the method {@link BlobAsyncClient#asBlockBlobAsyncClient()}, or via the method - * {@link ContainerAsyncClient#getBlockBlobAsyncClient(String)}. This class does not hold - * any state about a particular blob, but is instead a convenient way of sending appropriate - * requests to the resource on the service. - * - *

- * This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient}, - * and operations on the service are available on {@link StorageAsyncClient}. - * - *

- * Please refer - * to the Azure Docs - * for more information. - * - *

- * Note this client is an async client that returns reactive responses from Spring Reactor Core - * project (https://projectreactor.io/). Calling the methods in this client will NOT - * start the actual network operation, until {@code .subscribe()} is called on the reactive response. - * You can simply convert one of these responses to a {@link java.util.concurrent.CompletableFuture} - * object through {@link Mono#toFuture()}. - */ -public final class BlockBlobAsyncClient extends BlobAsyncClient { - - private BlockBlobAsyncRawClient blockBlobAsyncRawClient; - - /** - * Indicates the maximum number of bytes that can be sent in a call to upload. - */ - public static final int MAX_UPLOAD_BLOB_BYTES = 256 * Constants.MB; - - /** - * Indicates the maximum number of bytes that can be sent in a call to stageBlock. - */ - public static final int MAX_STAGE_BLOCK_BYTES = 100 * Constants.MB; - - /** - * Indicates the maximum number of blocks allowed in a block blob. - */ - public static final int MAX_BLOCKS = 50000; - - /** - * Package-private constructor for use by {@link BlockBlobClientBuilder}. - * @param azureBlobStorage the API client for blob storage API - */ - BlockBlobAsyncClient(AzureBlobStorageImpl azureBlobStorage) { - super(azureBlobStorage); - blockBlobAsyncRawClient = new BlockBlobAsyncRawClient(azureBlobStorage); - } - - /** - * Static method for getting a new builder for this class. - * - * @return - * A new {@link BlockBlobClientBuilder} instance. - */ - public static BlockBlobClientBuilder builder() { - return new BlockBlobClientBuilder(); - } - - /** - * Creates a new block blob, or updates the content of an existing block blob. - * Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not - * supported with PutBlob; the content of the existing blob is overwritten with the new content. To - * perform a partial update of a block blob's, use PutBlock and PutBlockList. - * For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - *

- * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flux must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * - * @return - * A reactive response containing the information of the uploaded block blob. - */ - public Mono upload(Flux data, long length) { - return this.upload(data, length, null, null, null, null); - } - - /** - * Creates a new block blob, or updates the content of an existing block blob. - * Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not - * supported with PutBlob; the content of the existing blob is overwritten with the new content. To - * perform a partial update of a block blob's, use PutBlock and PutBlockList. - * For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - *

- * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flux must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the information of the uploaded block blob. - */ - public Mono upload(Flux data, long length, BlobHTTPHeaders headers, - Metadata metadata, BlobAccessConditions accessConditions, Context context) { - return blockBlobAsyncRawClient - .upload(data.map(Unpooled::wrappedBuffer), length, headers, metadata, accessConditions, context) - .then(); - } - - public Mono uploadFromFile(String filePath) { - return this.uploadFromFile(filePath, null, null, null, null); - } - - public Mono uploadFromFile(String filePath, BlobHTTPHeaders headers, Metadata metadata, - BlobAccessConditions accessConditions, Context context) { - //TODO make this method smart - return this.blockBlobAsyncRawClient - .upload(ByteBufFlux.fromPath(Paths.get(filePath)), new File(filePath).length()) - .then(); - } - - /** - * Uploads the specified block to the block blob's "staging area" to be later committed by a call to - * commitBlockList. For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given - * blob must be the same length. - * @param data - * The data to write to the block. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flux must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * - * @return - * A reactive response signalling completion. - */ - public Mono stageBlock(String base64BlockID, Flux data, - long length) { - return this.stageBlock(base64BlockID, data, length, null, null); - } - - /** - * Uploads the specified block to the block blob's "staging area" to be later committed by a call to - * commitBlockList. For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given - * blob must be the same length. - * @param data - * The data to write to the block. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flux must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response signalling completion. - */ - public Mono stageBlock(String base64BlockID, Flux data, long length, - LeaseAccessConditions leaseAccessConditions, Context context) { - return blockBlobAsyncRawClient - .stageBlock(base64BlockID, data, length, leaseAccessConditions, context) - .then(); - } - - /** - * Creates a new block to be committed as part of a blob where the contents are read from a URL. For more - * information, see the Azure Docs. - * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given - * blob must be the same length. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * - * @return - * A reactive response signalling completion. - */ - public Mono stageBlockFromURL(String base64BlockID, URL sourceURL, - BlobRange sourceRange) { - return this.stageBlockFromURL(base64BlockID, sourceURL, sourceRange, null, - null, null, null); - } - - /** - * Creates a new block to be committed as part of a blob where the contents are read from a URL. For more - * information, see the Azure Docs. - * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given - * blob must be the same length. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param sourceModifiedAccessConditions - * {@link SourceModifiedAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response signalling completion. - */ - public Mono stageBlockFromURL(String base64BlockID, URL sourceURL, - BlobRange sourceRange, byte[] sourceContentMD5, LeaseAccessConditions leaseAccessConditions, - SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { - return blockBlobAsyncRawClient - .stageBlockFromURL(base64BlockID, sourceURL, sourceRange, sourceContentMD5, leaseAccessConditions, sourceModifiedAccessConditions, context) - .then(); - } - - /** - * Returns the list of blocks that have been uploaded as part of a block blob using the specified block list filter. - * For more information, see the - * Azure Docs. - * - * @param listType - * Specifies which type of blocks to return. - * - * @return - * A reactive response containing the list of blocks. - */ - public Flux listBlocks(BlockListType listType) { - return this.listBlocks(listType, null, null); - } - - /** - * - * Returns the list of blocks that have been uploaded as part of a block blob using the specified block list filter. - * For more information, see the - * Azure Docs. - * - * @param listType - * Specifies which type of blocks to return. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the list of blocks. - */ - public Flux listBlocks(BlockListType listType, - LeaseAccessConditions leaseAccessConditions, Context context) { - return blockBlobAsyncRawClient - .listBlocks(listType, leaseAccessConditions, context) - .map(ResponseBase::value) - .flatMapMany(bl -> { - Flux committed = Flux.fromIterable(bl.committedBlocks()) - .map(block -> new BlockItem(block, true)); - Flux uncommitted = Flux.fromIterable(bl.uncommittedBlocks()) - .map(block -> new BlockItem(block, false)); - return Flux.concat(committed, uncommitted); - }); - } - - /** - * Writes a blob by specifying the list of block IDs that are to make up the blob. - * In order to be written as part of a blob, a block must have been successfully written - * to the server in a prior stageBlock operation. You can call commitBlockList to update a blob - * by uploading only those blocks that have changed, then committing the new and existing - * blocks together. Any blocks not specified in the block list and permanently deleted. - * For more information, see the - * Azure Docs. - * - * @param base64BlockIDs - * A list of base64 encode {@code String}s that specifies the block IDs to be committed. - * - * @return - * A reactive response containing the information of the block blob. - */ - public Mono commitBlockList(List base64BlockIDs) { - return this.commitBlockList(base64BlockIDs, null, null, null, null); - } - - /** - * Writes a blob by specifying the list of block IDs that are to make up the blob. - * In order to be written as part of a blob, a block must have been successfully written - * to the server in a prior stageBlock operation. You can call commitBlockList to update a blob - * by uploading only those blocks that have changed, then committing the new and existing - * blocks together. Any blocks not specified in the block list and permanently deleted. - * For more information, see the - * Azure Docs. - * - * @param base64BlockIDs - * A list of base64 encode {@code String}s that specifies the block IDs to be committed. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the information of the block blob. - */ - public Mono commitBlockList(List base64BlockIDs, - BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions, Context context) { - return blockBlobAsyncRawClient - .commitBlockList(base64BlockIDs, headers, metadata, accessConditions, context) - .then(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlockBlobAsyncRawClient.java b/storage/client/src/main/java/com/azure/storage/blob/BlockBlobAsyncRawClient.java deleted file mode 100644 index 7c789842c05e5..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/BlockBlobAsyncRawClient.java +++ /dev/null @@ -1,394 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.*; -import io.netty.buffer.ByteBuf; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.net.URL; -import java.util.List; - -import static com.azure.storage.blob.Utility.postProcessResponse; - -/** - * Represents a URL to a block blob. It may be obtained by direct construction or via the create method on a - * {@link ContainerAsyncClient} object. This class does not hold any state about a particular blob but is instead a convenient - * way of sending off appropriate requests to the resource on the service. Please refer to the - * Azure Docs - * for more information on block blobs. - */ -final class BlockBlobAsyncRawClient extends BlobAsyncRawClient { - - /** - * Indicates the maximum number of bytes that can be sent in a call to upload. - */ - public static final int MAX_UPLOAD_BLOB_BYTES = 256 * Constants.MB; - - /** - * Indicates the maximum number of bytes that can be sent in a call to stageBlock. - */ - public static final int MAX_STAGE_BLOCK_BYTES = 100 * Constants.MB; - - /** - * Indicates the maximum number of blocks allowed in a block blob. - */ - public static final int MAX_BLOCKS = 50000; - - /** - * Creates a {@code BlockBlobAsyncRawClient} object pointing to the account specified by the URL and using the provided - */ - public BlockBlobAsyncRawClient(AzureBlobStorageImpl azureBlobStorage) { - super(azureBlobStorage); - } - - - /** - * Creates a new block blob, or updates the content of an existing block blob. - * Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not - * supported with PutBlob; the content of the existing blob is overwritten with the new content. To - * perform a partial update of a block blob's, use PutBlock and PutBlockList. - * For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - *

- * For more efficient bulk-upload scenarios, please refer to the {@link TransferManager} for convenience methods. - * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=upload_download "Sample code for BlockBlobAsyncRawClient.upload")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono upload(Flux data, long length) { - return this.upload(data, length, null, null, null, null); - } - - /** - * Creates a new block blob, or updates the content of an existing block blob. - * Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not - * supported with PutBlob; the content of the existing blob is overwritten with the new content. To - * perform a partial update of a block blob's, use PutBlock and PutBlockList. - * For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - *

- * For more efficient bulk-upload scenarios, please refer to the {@link TransferManager} for convenience methods. - * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=upload_download "Sample code for BlockBlobAsyncRawClient.upload")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono upload(Flux data, long length, BlobHTTPHeaders headers, - Metadata metadata, BlobAccessConditions accessConditions, Context context) { - metadata = metadata == null ? new Metadata() : metadata; - accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.blockBlobs().uploadWithRestResponseAsync(null, - null, data, length, null, metadata, null, null, - null, null, headers, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), context)); - } - - /** - * Uploads the specified block to the block blob's "staging area" to be later committed by a call to - * commitBlockList. For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given - * blob must be the same length. - * @param data - * The data to write to the block. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blocks "Sample code for BlockBlobAsyncRawClient.stageBlock")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono stageBlock(String base64BlockID, Flux data, - long length) { - return this.stageBlock(base64BlockID, data, length, null, null); - } - - /** - * Uploads the specified block to the block blob's "staging area" to be later committed by a call to - * commitBlockList. For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given - * blob must be the same length. - * @param data - * The data to write to the block. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blocks "Sample code for BlockBlobAsyncRawClient.stageBlock")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono stageBlock(String base64BlockID, Flux data, long length, - LeaseAccessConditions leaseAccessConditions, Context context) { - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.blockBlobs().stageBlockWithRestResponseAsync(null, - null, base64BlockID, length, data, null, null, null, - null, null, null, leaseAccessConditions, context)); - } - - /** - * Creates a new block to be committed as part of a blob where the contents are read from a URL. For more - * information, see the Azure Docs. - * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given - * blob must be the same length. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=block_from_url "Sample code for BlockBlobAsyncRawClient.stageBlockFromURL")] - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono stageBlockFromURL(String base64BlockID, URL sourceURL, - BlobRange sourceRange) { - return this.stageBlockFromURL(base64BlockID, sourceURL, sourceRange, null, - null, null, null); - } - - /** - * Creates a new block to be committed as part of a blob where the contents are read from a URL. For more - * information, see the Azure Docs. - * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given - * blob must be the same length. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param sourceModifiedAccessConditions - * {@link SourceModifiedAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=block_from_url "Sample code for BlockBlobAsyncRawClient.stageBlockFromURL")] - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono stageBlockFromURL(String base64BlockID, URL sourceURL, - BlobRange sourceRange, byte[] sourceContentMD5, LeaseAccessConditions leaseAccessConditions, - SourceModifiedAccessConditions sourceModifiedAccessConditions, Context context) { - sourceRange = sourceRange == null ? new BlobRange(0) : sourceRange; - context = context == null ? Context.NONE : context; - - return postProcessResponse( - this.azureBlobStorage.blockBlobs().stageBlockFromURLWithRestResponseAsync(null, null, - base64BlockID, 0, sourceURL, sourceRange.toHeaderValue(), sourceContentMD5, null, - null, null, null, null, - leaseAccessConditions, sourceModifiedAccessConditions, context)); - } - - /** - * Returns the list of blocks that have been uploaded as part of a block blob using the specified block list filter. - * For more information, see the - * Azure Docs. - * - * @param listType - * Specifies which type of blocks to return. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blocks "Sample code for BlockBlobAsyncRawClient.listBlocks")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono listBlocks(BlockListType listType) { - return this.listBlocks(listType, null, null); - } - - /** - * Returns the list of blocks that have been uploaded as part of a block blob using the specified block list filter. - * For more information, see the - * Azure Docs. - * - * @param listType - * Specifies which type of blocks to return. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blocks "Sample code for BlockBlobAsyncRawClient.listBlocks")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono listBlocks(BlockListType listType, - LeaseAccessConditions leaseAccessConditions, Context context) { - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.blockBlobs().getBlockListWithRestResponseAsync( - null, null, listType, null, null, null, null, - leaseAccessConditions, context)); - } - - /** - * Writes a blob by specifying the list of block IDs that are to make up the blob. - * In order to be written as part of a blob, a block must have been successfully written - * to the server in a prior stageBlock operation. You can call commitBlockList to update a blob - * by uploading only those blocks that have changed, then committing the new and existing - * blocks together. Any blocks not specified in the block list and permanently deleted. - * For more information, see the - * Azure Docs. - *

- * For more efficient bulk-upload scenarios, please refer to the {@link TransferManager} for convenience methods. - * - * @param base64BlockIDs - * A list of base64 encode {@code String}s that specifies the block IDs to be committed. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blocks "Sample code for BlockBlobAsyncRawClient.commitBlockList")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono commitBlockList(List base64BlockIDs) { - return this.commitBlockList(base64BlockIDs, null, null, null, null); - } - - /** - * Writes a blob by specifying the list of block IDs that are to make up the blob. - * In order to be written as part of a blob, a block must have been successfully written - * to the server in a prior stageBlock operation. You can call commitBlockList to update a blob - * by uploading only those blocks that have changed, then committing the new and existing - * blocks together. Any blocks not specified in the block list and permanently deleted. - * For more information, see the - * Azure Docs. - *

- * For more efficient bulk-upload scenarios, please refer to the {@link TransferManager} for convenience methods. - * - * @param base64BlockIDs - * A list of base64 encode {@code String}s that specifies the block IDs to be committed. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blocks "Sample code for BlockBlobAsyncRawClient.commitBlockList")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono commitBlockList(List base64BlockIDs, - BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions, Context context) { - metadata = metadata == null ? new Metadata() : metadata; - accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.blockBlobs().commitBlockListWithRestResponseAsync( - null, null, new BlockLookupList().latest(base64BlockIDs), null, metadata, - null, null, null, null, headers, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), context)); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlockBlobClient.java b/storage/client/src/main/java/com/azure/storage/blob/BlockBlobClient.java deleted file mode 100644 index 9d2c6088deb73..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/BlockBlobClient.java +++ /dev/null @@ -1,398 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.BlobHTTPHeaders; -import com.azure.storage.blob.models.BlockItem; -import com.azure.storage.blob.models.BlockListType; -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.SourceModifiedAccessConditions; -import io.netty.buffer.Unpooled; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.io.IOException; -import java.io.InputStream; -import java.io.UncheckedIOException; -import java.net.URL; -import java.nio.ByteBuffer; -import java.time.Duration; -import java.util.List; - -/** - * Client to a block blob. It may only be instantiated through a {@link BlockBlobClientBuilder}, via - * the method {@link BlobClient#asBlockBlobClient()}, or via the method - * {@link ContainerClient#getBlockBlobClient(String)}. This class does not hold - * any state about a particular blob, but is instead a convenient way of sending appropriate - * requests to the resource on the service. - * - *

- * This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, - * and operations on the service are available on {@link StorageClient}. - * - *

- * Please refer to the Azure Docs - * for more information. - */ -public final class BlockBlobClient extends BlobClient { - - private BlockBlobAsyncClient blockBlobAsyncClient; - /** - * Indicates the maximum number of bytes that can be sent in a call to upload. - */ - public static final int MAX_UPLOAD_BLOB_BYTES = 256 * Constants.MB; - - /** - * Indicates the maximum number of bytes that can be sent in a call to stageBlock. - */ - public static final int MAX_STAGE_BLOCK_BYTES = 100 * Constants.MB; - - /** - * Indicates the maximum number of blocks allowed in a block blob. - */ - public static final int MAX_BLOCKS = 50000; - - /** - * Package-private constructor for use by {@link BlockBlobClientBuilder}. - * @param azureBlobStorage the API client for blob storage API - */ - BlockBlobClient(AzureBlobStorageImpl azureBlobStorage) { - super(azureBlobStorage); - this.blockBlobAsyncClient = new BlockBlobAsyncClient(azureBlobStorage); - } - - /** - * Static method for getting a new builder for this class. - * - * @return - * A new {@link BlockBlobClientBuilder} instance. - */ - public static BlockBlobClientBuilder blockBlobClientBuilder() { - return new BlockBlobClientBuilder(); - } - - /** - * Creates a new block blob, or updates the content of an existing block blob. - * Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not - * supported with PutBlob; the content of the existing blob is overwritten with the new content. To - * perform a partial update of a block blob's, use PutBlock and PutBlockList. - * For more information, see the - * Azure Docs. - * - * @param data - * The data to write to the blob. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * provided in the {@link InputStream}. - * - * @return - * The information of the uploaded block blob. - */ - public void upload(InputStream data, long length) throws IOException { - this.upload(data, length, null, null, null, null, null); - } - - /** - * Creates a new block blob, or updates the content of an existing block blob. - * Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not - * supported with PutBlob; the content of the existing blob is overwritten with the new content. To - * perform a partial update of a block blob's, use PutBlock and PutBlockList. - * For more information, see the - * Azure Docs. - * - * @param data - * The data to write to the blob. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * provided in the {@link InputStream}. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * The information of the uploaded block blob. - */ - public void upload(InputStream data, long length, BlobHTTPHeaders headers, - Metadata metadata, BlobAccessConditions accessConditions, Duration timeout, Context context) throws IOException { - - // buffer strategy for UX study only - byte[] bufferedData = new byte[(int)length]; - data.read(bufferedData); - - Mono upload = blockBlobAsyncClient - .upload(Flux.just(ByteBuffer.wrap(bufferedData)), length, headers, metadata, accessConditions, context); - - try { - if (timeout == null) { - upload.block(); - } else { - upload.block(timeout); - } - } - catch (UncheckedIOException e) { - throw e.getCause(); - } - } - - public void uploadFromFile(String filePath) throws IOException { - this.uploadFromFile(filePath, null, null, null, null); - } - - public void uploadFromFile(String filePath, BlobHTTPHeaders headers, Metadata metadata, - BlobAccessConditions accessConditions, Duration timeout) throws IOException { - Mono upload = this.blockBlobAsyncClient.uploadFromFile(filePath, headers, metadata, accessConditions, null); - - try { - if (timeout == null) { - upload.block(); - } else { - upload.block(timeout); - } - } - catch (UncheckedIOException e) { - throw e.getCause(); - } - } - - /** - * Uploads the specified block to the block blob's "staging area" to be later committed by a call to - * commitBlockList. For more information, see the - * Azure Docs. - * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given - * blob must be the same length. - * @param data - * The data to write to the block. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * provided in the {@link InputStream}. - */ - public void stageBlock(String base64BlockID, InputStream data, long length) throws IOException { - this.stageBlock(base64BlockID, data, length, null, null, null); - } - - /** - * Uploads the specified block to the block blob's "staging area" to be later committed by a call to - * commitBlockList. For more information, see the - * Azure Docs. - * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given - * blob must be the same length. - * @param data - * The data to write to the block. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * provided in the {@link InputStream}. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - */ - public void stageBlock(String base64BlockID, InputStream data, long length, - LeaseAccessConditions leaseAccessConditions, Duration timeout, Context context) throws IOException { - - // buffer strategy for UX study only - byte[] bufferedData = new byte[(int)length]; - data.read(bufferedData); - - Mono response = blockBlobAsyncClient.stageBlock(base64BlockID, - Flux.just(Unpooled.wrappedBuffer(bufferedData)), length, leaseAccessConditions, context); - if (timeout == null) { - response.block(); - } else { - response.block(timeout); - } - } - - /** - * Creates a new block to be committed as part of a blob where the contents are read from a URL. For more - * information, see the Azure Docs. - * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given - * blob must be the same length. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - */ - public void stageBlockFromURL(String base64BlockID, URL sourceURL, - BlobRange sourceRange) { - this.stageBlockFromURL(base64BlockID, sourceURL, sourceRange, null, - null, null, null, null); - } - - /** - * Creates a new block to be committed as part of a blob where the contents are read from a URL. For more - * information, see the Azure Docs. - * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given - * blob must be the same length. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param sourceModifiedAccessConditions - * {@link SourceModifiedAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - */ - public void stageBlockFromURL(String base64BlockID, URL sourceURL, - BlobRange sourceRange, byte[] sourceContentMD5, LeaseAccessConditions leaseAccessConditions, - SourceModifiedAccessConditions sourceModifiedAccessConditions, Duration timeout, Context context) { - Mono response = blockBlobAsyncClient.stageBlockFromURL(base64BlockID, sourceURL, sourceRange, sourceContentMD5, leaseAccessConditions, sourceModifiedAccessConditions, context); - if (timeout == null) { - response.block(); - } else { - response.block(timeout); - } - } - - /** - * Returns the list of blocks that have been uploaded as part of a block blob using the specified block list filter. - * For more information, see the - * Azure Docs. - * - * @param listType - * Specifies which type of blocks to return. - * - * @return - * The list of blocks. - */ - public Iterable listBlocks(BlockListType listType) { - return this.listBlocks(listType, null, null, null); - } - - /** - * - * Returns the list of blocks that have been uploaded as part of a block blob using the specified block list filter. - * For more information, see the - * Azure Docs. - * - * @param listType - * Specifies which type of blocks to return. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * The list of blocks. - */ - public Iterable listBlocks(BlockListType listType, - LeaseAccessConditions leaseAccessConditions, Duration timeout, Context context) { - Flux response = blockBlobAsyncClient.listBlocks(listType, leaseAccessConditions, context); - - return timeout == null? - response.toIterable(): - response.timeout(timeout).toIterable(); - } - - /** - * Writes a blob by specifying the list of block IDs that are to make up the blob. - * In order to be written as part of a blob, a block must have been successfully written - * to the server in a prior stageBlock operation. You can call commitBlockList to update a blob - * by uploading only those blocks that have changed, then committing the new and existing - * blocks together. Any blocks not specified in the block list and permanently deleted. - * For more information, see the - * Azure Docs. - * - * @param base64BlockIDs - * A list of base64 encode {@code String}s that specifies the block IDs to be committed. - * - * @return - * The information of the block blob. - */ - public void commitBlockList(List base64BlockIDs) { - this.commitBlockList(base64BlockIDs, null, null, null, null, null); - } - - /** - * Writes a blob by specifying the list of block IDs that are to make up the blob. - * In order to be written as part of a blob, a block must have been successfully written - * to the server in a prior stageBlock operation. You can call commitBlockList to update a blob - * by uploading only those blocks that have changed, then committing the new and existing - * blocks together. Any blocks not specified in the block list and permanently deleted. - * For more information, see the - * Azure Docs. - * - * @param base64BlockIDs - * A list of base64 encode {@code String}s that specifies the block IDs to be committed. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * The information of the block blob. - */ - public void commitBlockList(List base64BlockIDs, - BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions, Duration timeout, Context context) { - Mono response = blockBlobAsyncClient.commitBlockList(base64BlockIDs, headers, metadata, accessConditions, context); - - if (timeout == null) { - response.block(); - } else { - response.block(timeout); - } - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlockBlobClientBuilder.java b/storage/client/src/main/java/com/azure/storage/blob/BlockBlobClientBuilder.java deleted file mode 100644 index 0c277c1e35444..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/BlockBlobClientBuilder.java +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.util.configuration.Configuration; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLoggingPolicy; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.implementation.util.ImplUtils; -import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * Fluent BlockBlobClientBuilder for instantiating a {@link BlockBlobClient} or {@link BlockBlobAsyncClient}. - * - *

- * An instance of this builder may only be created from static method {@link BlockBlobClient#blockBlobClientBuilder()}. - * The following information must be provided on this builder: - * - *

    - *
  • the endpoint through {@code .endpoint()}, including the container name and blob name, in the format of {@code https://{accountName}.blob.core.windows.net/{containerName}/{blobName}}. - *
  • the credential through {@code .credentials()} or {@code .connectionString()} if the container is not publicly accessible. - *
- * - *

- * Once all the configurations are set on this builder, call {@code .buildClient()} to create a - * {@link BlockBlobClient} or {@code .buildAsyncClient()} to create a {@link BlockBlobAsyncClient}. - */ -public final class BlockBlobClientBuilder { - private static final String ACCOUNT_NAME = "AccountName".toLowerCase(); - private static final String ACCOUNT_KEY = "AccountKey".toLowerCase(); - - private final List policies; - - private URL endpoint; - private ICredentials credentials = new AnonymousCredentials(); - private HttpClient httpClient; - private HttpLogDetailLevel logLevel; - private RetryPolicy retryPolicy; - private Configuration configuration; - - public BlockBlobClientBuilder() { - retryPolicy = new RetryPolicy(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); - } - - /** - * Constructs an instance of BlockBlobAsyncClient based on the configurations stored in the appendBlobClientBuilder. - * @return a new client instance - */ - private AzureBlobStorageImpl buildImpl() { - Objects.requireNonNull(endpoint); - - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - policies.add(new UserAgentPolicy(BlobConfiguration.NAME, BlobConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - policies.add(credentials); // This needs to be a different credential type. - - policies.add(retryPolicy); - - policies.addAll(this.policies); - policies.add(new HttpLoggingPolicy(logLevel)); - - HttpPipeline pipeline = HttpPipeline.builder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); - - return new AzureBlobStorageBuilder() - .url(endpoint.toString()) - .pipeline(pipeline) - .build(); - } - - /** - * @return a {@link BlockBlobClient} created from the configurations in this builder. - */ - public BlockBlobClient buildClient() { - return new BlockBlobClient(buildImpl()); - } - - /** - * @return a {@link BlockBlobAsyncClient} created from the configurations in this builder. - */ - public BlockBlobAsyncClient buildAsyncClient() { - return new BlockBlobAsyncClient(buildImpl()); - } - - /** - * Sets the service endpoint, additionally parses it for information (SAS token, container name) - * @param endpoint URL of the service - * @return the updated BlockBlobClientBuilder object - */ - public BlockBlobClientBuilder endpoint(String endpoint) { - Objects.requireNonNull(endpoint); - try { - this.endpoint = new URL(endpoint); - } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage Queue endpoint url is malformed."); - } - - return this; - } - - /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials - * @return the updated BlockBlobClientBuilder object - */ - public BlockBlobClientBuilder credentials(SharedKeyCredentials credentials) { - this.credentials = credentials; - return this; - } - - /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials - * @return the updated BlockBlobClientBuilder object - */ - public BlockBlobClientBuilder credentials(TokenCredentials credentials) { - this.credentials = credentials; - return this; - } - - /** - * Clears the credentials used to authorize requests sent to the service - * @return the updated BlockBlobClientBuilder object - */ - public BlockBlobClientBuilder anonymousCredentials() { - this.credentials = new AnonymousCredentials(); - return this; - } - - /** - * Sets the connection string for the service, parses it for authentication information (account name, account key) - * @param connectionString connection string from access keys section - * @return the updated BlockBlobClientBuilder object - */ - public BlockBlobClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - - Map connectionKVPs = new HashMap<>(); - for (String s : connectionString.split(";")) { - String[] kvp = s.split("=", 2); - connectionKVPs.put(kvp[0].toLowerCase(), kvp[1]); - } - - String accountName = connectionKVPs.get(ACCOUNT_NAME); - String accountKey = connectionKVPs.get(ACCOUNT_KEY); - - if (ImplUtils.isNullOrEmpty(accountName) || ImplUtils.isNullOrEmpty(accountKey)) { - throw new IllegalArgumentException("Connection string must contain 'AccountName' and 'AccountKey'."); - } - - // Use accountName and accountKey to get the SAS token using the credential class. - credentials = new SharedKeyCredentials(accountName, accountKey); - - return this; - } - - /** - * Sets the http client used to send service requests - * @param httpClient http client to send requests - * @return the updated BlockBlobClientBuilder object - */ - public BlockBlobClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /** - * Adds a pipeline policy to apply on each request sent - * @param pipelinePolicy a pipeline policy - * @return the updated BlockBlobClientBuilder object - */ - public BlockBlobClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - this.policies.add(pipelinePolicy); - return this; - } - - /** - * Sets the logging level for service requests - * @param logLevel logging level - * @return the updated BlockBlobClientBuilder object - */ - public BlockBlobClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { - this.logLevel = logLevel; - return this; - } - - /** - * Sets the configuration object used to retrieve environment configuration values used to buildClient the client with - * when they are not set in the appendBlobClientBuilder, defaults to Configuration.NONE - * @param configuration configuration store - * @return the updated BlockBlobClientBuilder object - */ - public BlockBlobClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/BlockBlobRawClient.java b/storage/client/src/main/java/com/azure/storage/blob/BlockBlobRawClient.java deleted file mode 100644 index 07260ffa53f63..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/BlockBlobRawClient.java +++ /dev/null @@ -1,379 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.*; -import io.netty.buffer.ByteBuf; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.net.URL; -import java.time.Duration; -import java.util.List; - -/** - * Represents a URL to a block blob. It may be obtained by direct construction or via the create method on a - * {@link ContainerAsyncClient} object. This class does not hold any state about a particular blob but is instead a convenient - * way of sending off appropriate requests to the resource on the service. Please refer to the - * Azure Docs - * for more information on block blobs. - */ -final class BlockBlobRawClient extends BlobAsyncRawClient { - - private BlockBlobAsyncRawClient blockBlobAsyncRawClient; - /** - * Indicates the maximum number of bytes that can be sent in a call to upload. - */ - public static final int MAX_UPLOAD_BLOB_BYTES = 256 * Constants.MB; - - /** - * Indicates the maximum number of bytes that can be sent in a call to stageBlock. - */ - public static final int MAX_STAGE_BLOCK_BYTES = 100 * Constants.MB; - - /** - * Indicates the maximum number of blocks allowed in a block blob. - */ - public static final int MAX_BLOCKS = 50000; - - /** - * Creates a {@code BlockBlobAsyncRawClient} object pointing to the account specified by the URL and using the provided - */ - BlockBlobRawClient(AzureBlobStorageImpl azureBlobStorage) { - super(azureBlobStorage); - this.blockBlobAsyncRawClient = new BlockBlobAsyncRawClient(azureBlobStorage); - } - - /** - * Creates a new block blob, or updates the content of an existing block blob. - * Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not - * supported with PutBlob; the content of the existing blob is overwritten with the new content. To - * perform a partial update of a block blob's, use PutBlock and PutBlockList. - * For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - *

- * For more efficient bulk-upload scenarios, please refer to the {@link TransferManager} for convenience methods. - * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=upload_download "Sample code for BlockBlobAsyncRawClient.upload")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlockBlobsUploadResponse upload(Flux data, long length) { - return this.upload(data, length, null, null, null, null, null); - } - - /** - * Creates a new block blob, or updates the content of an existing block blob. - * Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not - * supported with PutBlob; the content of the existing blob is overwritten with the new content. To - * perform a partial update of a block blob's, use PutBlock and PutBlockList. - * For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - *

- * For more efficient bulk-upload scenarios, please refer to the {@link TransferManager} for convenience methods. - * - * @param data - * The data to write to the blob. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=upload_download "Sample code for BlockBlobAsyncRawClient.upload")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlockBlobsUploadResponse upload(Flux data, long length, BlobHTTPHeaders headers, - Metadata metadata, BlobAccessConditions accessConditions, Duration timeout, Context context) { - Mono response = blockBlobAsyncRawClient.upload(data, length, headers, metadata, accessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } - - /** - * Uploads the specified block to the block blob's "staging area" to be later committed by a call to - * commitBlockList. For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given - * blob must be the same length. - * @param data - * The data to write to the block. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blocks "Sample code for BlockBlobAsyncRawClient.stageBlock")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlockBlobsStageBlockResponse stageBlock(String base64BlockID, Flux data, long length) { - return this.stageBlock(base64BlockID, data, length, null, null, null); - } - - /** - * Uploads the specified block to the block blob's "staging area" to be later committed by a call to - * commitBlockList. For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given - * blob must be the same length. - * @param data - * The data to write to the block. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * @param length - * The exact length of the data. It is important that this value match precisely the length of the data - * emitted by the {@code Flux}. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blocks "Sample code for BlockBlobAsyncRawClient.stageBlock")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlockBlobsStageBlockResponse stageBlock(String base64BlockID, Flux data, long length, - LeaseAccessConditions leaseAccessConditions, Duration timeout, Context context) { - Mono response = blockBlobAsyncRawClient.stageBlock(base64BlockID, data, length, leaseAccessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } - - /** - * Creates a new block to be committed as part of a blob where the contents are read from a URL. For more - * information, see the Azure Docs. - * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given - * blob must be the same length. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=block_from_url "Sample code for BlockBlobAsyncRawClient.stageBlockFromURL")] - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlockBlobsStageBlockFromURLResponse stageBlockFromURL(String base64BlockID, URL sourceURL, - BlobRange sourceRange) { - return this.stageBlockFromURL(base64BlockID, sourceURL, sourceRange, null, - null, null, null, null); - } - - /** - * Creates a new block to be committed as part of a blob where the contents are read from a URL. For more - * information, see the Azure Docs. - * - * @param base64BlockID - * A Base64 encoded {@code String} that specifies the ID for this block. Note that all block ids for a given - * blob must be the same length. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can - * be authenticated via Shared Key. However, if the source is a blob in another account, the source blob - * must either be public or must be authenticated via a shared access signature. If the source blob is - * public, no authentication is required to perform the operation. - * @param sourceRange - * {@link BlobRange} - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param sourceModifiedAccessConditions - * {@link SourceModifiedAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=block_from_url "Sample code for BlockBlobAsyncRawClient.stageBlockFromURL")] - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlockBlobsStageBlockFromURLResponse stageBlockFromURL(String base64BlockID, URL sourceURL, - BlobRange sourceRange, byte[] sourceContentMD5, LeaseAccessConditions leaseAccessConditions, - SourceModifiedAccessConditions sourceModifiedAccessConditions, Duration timeout, Context context) { - Mono response = blockBlobAsyncRawClient.stageBlockFromURL(base64BlockID, sourceURL, sourceRange, sourceContentMD5, leaseAccessConditions, sourceModifiedAccessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } - - /** - * Returns the list of blocks that have been uploaded as part of a block blob using the specified block list filter. - * For more information, see the - * Azure Docs. - * - * @param listType - * Specifies which type of blocks to return. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blocks "Sample code for BlockBlobAsyncRawClient.listBlocks")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlockBlobsGetBlockListResponse getBlockList(BlockListType listType) { - return this.getBlockList(listType, null, null, null); - } - - /** - * Returns the list of blocks that have been uploaded as part of a block blob using the specified block list filter. - * For more information, see the - * Azure Docs. - * - * @param listType - * Specifies which type of blocks to return. - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blocks "Sample code for BlockBlobAsyncRawClient.listBlocks")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlockBlobsGetBlockListResponse getBlockList(BlockListType listType, - LeaseAccessConditions leaseAccessConditions, Duration timeout, Context context) { - Mono response = blockBlobAsyncRawClient.listBlocks(listType, leaseAccessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } - - /** - * Writes a blob by specifying the list of block IDs that are to make up the blob. - * In order to be written as part of a blob, a block must have been successfully written - * to the server in a prior stageBlock operation. You can call commitBlockList to update a blob - * by uploading only those blocks that have changed, then committing the new and existing - * blocks together. Any blocks not specified in the block list and permanently deleted. - * For more information, see the - * Azure Docs. - *

- * For more efficient bulk-upload scenarios, please refer to the {@link TransferManager} for convenience methods. - * - * @param base64BlockIDs - * A list of base64 encode {@code String}s that specifies the block IDs to be committed. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blocks "Sample code for BlockBlobAsyncRawClient.commitBlockList")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlockBlobsCommitBlockListResponse commitBlockList(List base64BlockIDs) { - return this.commitBlockList(base64BlockIDs, null, null, null, null, null); - } - - /** - * Writes a blob by specifying the list of block IDs that are to make up the blob. - * In order to be written as part of a blob, a block must have been successfully written - * to the server in a prior stageBlock operation. You can call commitBlockList to update a blob - * by uploading only those blocks that have changed, then committing the new and existing - * blocks together. Any blocks not specified in the block list and permanently deleted. - * For more information, see the - * Azure Docs. - *

- * For more efficient bulk-upload scenarios, please refer to the {@link TransferManager} for convenience methods. - * - * @param base64BlockIDs - * A list of base64 encode {@code String}s that specifies the block IDs to be committed. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=blocks "Sample code for BlockBlobAsyncRawClient.commitBlockList")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public BlockBlobsCommitBlockListResponse commitBlockList(List base64BlockIDs, - BlobHTTPHeaders headers, Metadata metadata, BlobAccessConditions accessConditions, Duration timeout, Context context) { - Mono response = blockBlobAsyncRawClient.commitBlockList(base64BlockIDs, headers, metadata, accessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/CommonRestResponse.java b/storage/client/src/main/java/com/azure/storage/blob/CommonRestResponse.java deleted file mode 100644 index 38a68dbd41b6e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/CommonRestResponse.java +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.rest.Response; -import com.azure.storage.blob.models.BlockBlobsCommitBlockListResponse; -import com.azure.storage.blob.models.BlockBlobsUploadResponse; - -import java.time.OffsetDateTime; - -/** - * A generic wrapper for any type of blob REST API response. Used and returned by methods in the {@link TransferManager} - * class. The methods there return this type because they represent composite operations which may conclude with any of - * several possible REST calls depending on the data provided. - */ -final class CommonRestResponse { - - private BlockBlobsUploadResponse uploadBlobResponse; - - private BlockBlobsCommitBlockListResponse commitBlockListResponse; - - private CommonRestResponse() { - uploadBlobResponse = null; - commitBlockListResponse = null; - } - - static CommonRestResponse createFromPutBlobResponse(BlockBlobsUploadResponse response) { - CommonRestResponse commonRestResponse = new CommonRestResponse(); - commonRestResponse.uploadBlobResponse = response; - return commonRestResponse; - } - - static CommonRestResponse createFromPutBlockListResponse(BlockBlobsCommitBlockListResponse response) { - CommonRestResponse commonRestResponse = new CommonRestResponse(); - commonRestResponse.commitBlockListResponse = response; - return commonRestResponse; - } - - /** - * @return The status code for the response - */ - public int statusCode() { - if (uploadBlobResponse != null) { - return uploadBlobResponse.statusCode(); - } - return commitBlockListResponse.statusCode(); - } - - /** - * @return An HTTP Etag for the blob at the time of the request. - */ - public String eTag() { - if (uploadBlobResponse != null) { - return uploadBlobResponse.deserializedHeaders().eTag(); - } - return commitBlockListResponse.deserializedHeaders().eTag(); - } - - /** - * @return The time when the blob was last modified. - */ - public OffsetDateTime lastModified() { - if (uploadBlobResponse != null) { - return uploadBlobResponse.deserializedHeaders().lastModified(); - } - return commitBlockListResponse.deserializedHeaders().lastModified(); - } - - /** - * @return The id of the service request for which this is the response. - */ - public String requestId() { - if (uploadBlobResponse != null) { - return uploadBlobResponse.deserializedHeaders().requestId(); - } - return commitBlockListResponse.deserializedHeaders().requestId(); - } - - /** - * @return The date of the response. - */ - public OffsetDateTime date() { - if (uploadBlobResponse != null) { - return uploadBlobResponse.deserializedHeaders().dateProperty(); - } - return commitBlockListResponse.deserializedHeaders().dateProperty(); - } - - /** - * @return The service version responding to the request. - */ - public String version() { - if (uploadBlobResponse != null) { - return uploadBlobResponse.deserializedHeaders().version(); - } - return commitBlockListResponse.deserializedHeaders().version(); - } - - /** - * @return The underlying response. - */ - public Response response() { - if (uploadBlobResponse != null) { - return uploadBlobResponse; - } - return commitBlockListResponse; - } - -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/Constants.java b/storage/client/src/main/java/com/azure/storage/blob/Constants.java deleted file mode 100644 index a7b0d3e145c3f..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/Constants.java +++ /dev/null @@ -1,299 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -/** - * RESERVED FOR INTERNAL USE. Contains storage constants. - */ -final class Constants { - - /** - * The master Microsoft Azure Storage header prefix. - */ - static final String PREFIX_FOR_STORAGE_HEADER = "x-ms-"; - /** - * Constant representing a kilobyte (Non-SI version). - */ - static final int KB = 1024; - /** - * Constant representing a megabyte (Non-SI version). - */ - static final int MB = 1024 * KB; - /** - * An empty {@code String} to use for comparison. - */ - static final String EMPTY_STRING = ""; - /** - * Specifies HTTP. - */ - static final String HTTP = "http"; - /** - * Specifies HTTPS. - */ - static final String HTTPS = "https"; - /** - * Specifies both HTTPS and HTTP. - */ - static final String HTTPS_HTTP = "https,http"; - /** - * The default type for content-type and accept. - */ - static final String UTF8_CHARSET = "UTF-8"; - /** - * The query parameter for snapshots. - */ - static final String SNAPSHOT_QUERY_PARAMETER = "snapshot"; - /** - * The word redacted. - */ - static final String REDACTED = "REDACTED"; - /** - * The default amount of parallelism for TransferManager operations. - */ - // We chose this to match Go, which followed AWS' default. - static final int TRANSFER_MANAGER_DEFAULT_PARALLELISM = 5; - - /** - * Private Default Ctor - */ - private Constants() { - // Private to prevent construction. - } - - /** - * Defines constants for use with HTTP headers. - */ - static final class HeaderConstants { - /** - * The Authorization header. - */ - static final String AUTHORIZATION = "Authorization"; - - /** - * The format string for specifying ranges with only begin offset. - */ - static final String BEGIN_RANGE_HEADER_FORMAT = "bytes=%d-"; - - /** - * The header that indicates the client request ID. - */ - static final String CLIENT_REQUEST_ID_HEADER = PREFIX_FOR_STORAGE_HEADER + "client-request-id"; - - /** - * The ContentEncoding header. - */ - static final String CONTENT_ENCODING = "Content-Encoding"; - - /** - * The ContentLangauge header. - */ - static final String CONTENT_LANGUAGE = "Content-Language"; - - /** - * The ContentLength header. - */ - static final String CONTENT_LENGTH = "Content-Length"; - - /** - * The ContentMD5 header. - */ - static final String CONTENT_MD5 = "Content-MD5"; - - /** - * The ContentType header. - */ - static final String CONTENT_TYPE = "Content-Type"; - - /** - * The header that specifies the date. - */ - static final String DATE = PREFIX_FOR_STORAGE_HEADER + "date"; - - /** - * The header that specifies the error code on unsuccessful responses. - */ - static final String ERROR_CODE = PREFIX_FOR_STORAGE_HEADER + "error-code"; - - /** - * The IfMatch header. - */ - static final String IF_MATCH = "If-Match"; - - /** - * The IfModifiedSince header. - */ - static final String IF_MODIFIED_SINCE = "If-Modified-Since"; - - /** - * The IfNoneMatch header. - */ - static final String IF_NONE_MATCH = "If-None-Match"; - - /** - * The IfUnmodifiedSince header. - */ - static final String IF_UNMODIFIED_SINCE = "If-Unmodified-Since"; - - /** - * The Range header. - */ - static final String RANGE = "Range"; - - /** - * The format string for specifying ranges. - */ - static final String RANGE_HEADER_FORMAT = "bytes=%d-%d"; - - /** - * The copy source header. - */ - static final String COPY_SOURCE = "x-ms-copy-source"; - - /** - * The version header. - */ - static final String VERSION = "x-ms-version"; - - /** - * The current storage version header value. - */ - static final String TARGET_STORAGE_VERSION = "2018-11-09"; - - /** - * The UserAgent header. - */ - static final String USER_AGENT = "User-Agent"; - - /** - * Specifies the value to use for UserAgent header. - */ - static final String USER_AGENT_PREFIX = "Azure-Storage"; - - /** - * Specifies the value to use for UserAgent header. - */ - static final String USER_AGENT_VERSION = "11.0.1"; - - private HeaderConstants() { - // Private to prevent construction. - } - } - - static final class UrlConstants { - - /** - * The SAS service version parameter. - */ - static final String SAS_SERVICE_VERSION = "sv"; - - /** - * The SAS services parameter. - */ - static final String SAS_SERVICES = "ss"; - - /** - * The SAS resource types parameter. - */ - static final String SAS_RESOURCES_TYPES = "srt"; - - /** - * The SAS protocol parameter. - */ - static final String SAS_PROTOCOL = "spr"; - - /** - * The SAS start time parameter. - */ - static final String SAS_START_TIME = "st"; - - /** - * The SAS expiration time parameter. - */ - static final String SAS_EXPIRY_TIME = "se"; - - /** - * The SAS IP range parameter. - */ - static final String SAS_IP_RANGE = "sip"; - - /** - * The SAS signed identifier parameter. - */ - static final String SAS_SIGNED_IDENTIFIER = "si"; - - /** - * The SAS signed resource parameter. - */ - static final String SAS_SIGNED_RESOURCE = "sr"; - - /** - * The SAS signed permissions parameter. - */ - static final String SAS_SIGNED_PERMISSIONS = "sp"; - - /** - * The SAS signature parameter. - */ - static final String SAS_SIGNATURE = "sig"; - - /** - * The SAS cache control parameter. - */ - static final String SAS_CACHE_CONTROL = "rscc"; - - /** - * The SAS content disposition parameter. - */ - static final String SAS_CONTENT_DISPOSITION = "rscd"; - - /** - * The SAS content encoding parameter. - */ - static final String SAS_CONTENT_ENCODING = "rsce"; - - /** - * The SAS content language parameter. - */ - static final String SAS_CONTENT_LANGUAGE = "rscl"; - - /** - * The SAS content type parameter. - */ - static final String SAS_CONTENT_TYPE = "rsct"; - - /** - * The SAS signed object id parameter for user delegation SAS. - */ - public static final String SAS_SIGNED_OBJECT_ID = "skoid"; - - /** - * The SAS signed tenant id parameter for user delegation SAS. - */ - public static final String SAS_SIGNED_TENANT_ID = "sktid"; - - /** - * The SAS signed key-start parameter for user delegation SAS. - */ - public static final String SAS_SIGNED_KEY_START = "skt"; - - /** - * The SAS signed key-expiry parameter for user delegation SAS. - */ - public static final String SAS_SIGNED_KEY_EXPIRY = "ske"; - - /** - * The SAS signed service parameter for user delegation SAS. - */ - public static final String SAS_SIGNED_KEY_SERVICE = "sks"; - - /** - * The SAS signed version parameter for user delegation SAS. - */ - public static final String SAS_SIGNED_KEY_VERSION = "skv"; - - private UrlConstants() { - // Private to prevent construction. - } - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/ContainerAccessConditions.java b/storage/client/src/main/java/com/azure/storage/blob/ContainerAccessConditions.java deleted file mode 100644 index f2b9ca1c04f5e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/ContainerAccessConditions.java +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.ModifiedAccessConditions; - -/** - * This class contains values which will restrict the successful operation of a variety of requests to the conditions - * present. These conditions are entirely optional. The entire object or any of its properties may be set to null when - * passed to a method to indicate that those conditions are not desired. Please refer to the type of each field for more - * information on those particular access conditions. - */ -public final class ContainerAccessConditions { - - private ModifiedAccessConditions modifiedAccessConditions; - - private LeaseAccessConditions leaseAccessConditions; - - /** - * Creates an instance which has fields set to non-null, empty values. - */ - public ContainerAccessConditions() { - this.modifiedAccessConditions = new ModifiedAccessConditions(); - this.leaseAccessConditions = new LeaseAccessConditions(); - } - - /** - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used to - * construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - */ - public ModifiedAccessConditions modifiedAccessConditions() { - return modifiedAccessConditions; - } - - /** - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used to - * construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - */ - public ContainerAccessConditions withModifiedAccessConditions(ModifiedAccessConditions modifiedAccessConditions) { - this.modifiedAccessConditions = modifiedAccessConditions; - return this; - } - - /** - * By setting lease access conditions, requests will fail if the provided lease does not match the active lease on - * the blob. - */ - public LeaseAccessConditions leaseAccessConditions() { - return leaseAccessConditions; - } - - /** - * By setting lease access conditions, requests will fail if the provided lease does not match the active lease on - * the blob. - */ - public ContainerAccessConditions withLeaseAccessConditions(LeaseAccessConditions leaseID) { - this.leaseAccessConditions = leaseID; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java b/storage/client/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java deleted file mode 100644 index 447501a3666cb..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/ContainerAsyncClient.java +++ /dev/null @@ -1,759 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.rest.ResponseBase; -import com.azure.core.util.Context; -import com.azure.storage.blob.models.BlobItem; -import com.azure.storage.blob.models.ContainerGetAccessPolicyHeaders; -import com.azure.storage.blob.models.ContainersListBlobFlatSegmentResponse; -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.ModifiedAccessConditions; -import com.azure.storage.blob.models.PublicAccessType; -import com.azure.storage.blob.models.SignedIdentifier; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; - -/** - * Client to a container. It may only be instantiated through a {@link ContainerClientBuilder} or via the method - * {@link StorageAsyncClient#getContainerAsyncClient(String)}. This class does not hold any - * state about a particular blob but is instead a convenient way of sending off appropriate requests to - * the resource on the service. It may also be used to construct URLs to blobs. - * - *

- * This client contains operations on a container. Operations on a blob are available on {@link BlobAsyncClient} through - * {@link #getBlobAsyncClient(String)}, and operations on the service are available on {@link StorageAsyncClient}. - * - *

- * Please refer to the Azure Docs - * for more information on containers. - * - *

- * Note this client is an async client that returns reactive responses from Spring Reactor Core - * project (https://projectreactor.io/). Calling the methods in this client will NOT - * start the actual network operation, until {@code .subscribe()} is called on the reactive response. - * You can simply convert one of these responses to a {@link java.util.concurrent.CompletableFuture} - * object through {@link Mono#toFuture()}. - */ -public final class ContainerAsyncClient { - - ContainerAsyncRawClient containerAsyncRawClient; - private ContainerClientBuilder builder; - - public static final String ROOT_CONTAINER_NAME = "$root"; - - public static final String STATIC_WEBSITE_CONTAINER_NAME = "$web"; - - public static final String LOG_CONTAINER_NAME = "$logs"; - - /** - * Package-private constructor for use by {@link ContainerClientBuilder}. - * @param builder the container client builder - */ - ContainerAsyncClient(ContainerClientBuilder builder) { - this.builder = builder; - this.containerAsyncRawClient = new ContainerAsyncRawClient(builder.buildImpl()); - } - - /** - * @return a new client {@link ContainerClientBuilder} instance. - */ - public static ContainerClientBuilder containerClientBuilder() { - return new ContainerClientBuilder(); - } - - /** - * Creates a new {@link BlockBlobAsyncClient} object by concatenating the blobName to the end of - * ContainerAsyncClient's URL. The new BlockBlobAsyncClient uses the same request policy pipeline as the ContainerAsyncClient. - * To change the pipeline, create the BlockBlobAsyncClient and then call its WithPipeline method passing in the - * desired pipeline object. Or, call this package's NewBlockBlobAsyncClient instead of calling this object's - * NewBlockBlobAsyncClient method. - * - * @param blobName - * A {@code String} representing the name of the blob. - * - * @return A new {@link BlockBlobAsyncClient} object which references the blob with the specified name in this container. - */ - public BlockBlobAsyncClient getBlockBlobAsyncClient(String blobName) { - try { - return new BlockBlobAsyncClient(this.builder.copyBuilder().endpoint(Utility.appendToURLPath(new URL(builder.endpoint()), blobName).toString()).buildImpl()); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - - /** - * Creates creates a new PageBlobAsyncClient object by concatenating blobName to the end of - * ContainerAsyncClient's URL. The new PageBlobAsyncClient uses the same request policy pipeline as the ContainerAsyncClient. - * To change the pipeline, create the PageBlobAsyncClient and then call its WithPipeline method passing in the - * desired pipeline object. Or, call this package's NewPageBlobAsyncClient instead of calling this object's - * NewPageBlobAsyncClient method. - * - * @param blobName - * A {@code String} representing the name of the blob. - * - * @return A new {@link PageBlobAsyncClient} object which references the blob with the specified name in this container. - */ - public PageBlobAsyncClient getPageBlobAsyncClient(String blobName) { - try { - return new PageBlobAsyncClient(this.builder.copyBuilder().endpoint(Utility.appendToURLPath(new URL(builder.endpoint()), blobName).toString()).buildImpl()); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - - /** - * Creates creates a new AppendBlobAsyncClient object by concatenating blobName to the end of - * ContainerAsyncClient's URL. The new AppendBlobAsyncClient uses the same request policy pipeline as the ContainerAsyncClient. - * To change the pipeline, create the AppendBlobAsyncClient and then call its WithPipeline method passing in the - * desired pipeline object. Or, call this package's NewAppendBlobAsyncClient instead of calling this object's - * NewAppendBlobAsyncClient method. - * - * @param blobName - * A {@code String} representing the name of the blob. - * - * @return A new {@link AppendBlobAsyncClient} object which references the blob with the specified name in this container. - */ - public AppendBlobAsyncClient getAppendBlobAsyncClient(String blobName) { - try { - return new AppendBlobAsyncClient(this.builder.copyBuilder().endpoint(Utility.appendToURLPath(new URL(builder.endpoint()), blobName).toString()).buildImpl()); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - - /** - * Creates a new BlobAsyncClient object by concatenating blobName to the end of - * ContainerAsyncClient's URL. The new BlobAsyncClient uses the same request policy pipeline as the ContainerAsyncClient. - * To change the pipeline, create the BlobAsyncClient and then call its WithPipeline method passing in the - * desired pipeline object. Or, call this package's getBlobAsyncClient instead of calling this object's - * getBlobAsyncClient method. - * - * @param blobName - * A {@code String} representing the name of the blob. - * - * @return A new {@link BlobAsyncClient} object which references the blob with the specified name in this container. - */ - public BlobAsyncClient getBlobAsyncClient(String blobName) { - try { - return new BlobAsyncClient(this.builder.copyBuilder().endpoint(Utility.appendToURLPath(new URL(builder.endpoint()), blobName).toString()).buildImpl()); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - - /** - * Creates a new container within a storage account. If a container with the same name already exists, the operation - * fails. For more information, see the - * Azure Docs. - * - * @return - * A reactive response signalling completion. - */ - public Mono create() { - return this.create(null, null, null); - } - - /** - * Creates a new container within a storage account. If a container with the same name already exists, the operation - * fails. For more information, see the - * Azure Docs. - * - * @param metadata - * {@link Metadata} - * @param accessType - * Specifies how the data in this container is available to the public. See the x-ms-blob-public-access header - * in the Azure Docs for more information. Pass null for no public access. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return - * A reactive response signalling completion. - */ - public Mono create(Metadata metadata, PublicAccessType accessType, Context context) { - return containerAsyncRawClient - .create(metadata, accessType, context) - .then(); - } - - /** - * Marks the specified container for deletion. The container and any blobs contained within it are later - * deleted during garbage collection. For more information, see the - * Azure Docs. - * - * @return - * A reactive response signalling completion. - */ - public Mono delete() { - return this.delete(null, null); - } - - /** - * Marks the specified container for deletion. The container and any blobs contained within it are later - * deleted during garbage collection. For more information, see the - * Azure Docs. - * - * @param accessConditions - * {@link ContainerAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return - * A reactive response signalling completion. - */ - public Mono delete(ContainerAccessConditions accessConditions, Context context) { - return containerAsyncRawClient - .delete(accessConditions, context) - .then(); - } - - /** - * Returns the container's metadata and system properties. For more information, see the - * Azure Docs. - * - * @return - * A reactive response containing the container properties. - */ - public Mono getProperties() { - return this.getProperties(null, null); - } - - /** - * Returns the container's metadata and system properties. For more information, see the - * Azure Docs. - * - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return - * A reactive response containing the container properties. - */ - public Mono getProperties(LeaseAccessConditions leaseAccessConditions, - Context context) { - return containerAsyncRawClient - .getProperties(leaseAccessConditions, context) - .map(ResponseBase::deserializedHeaders) - .map(ContainerProperties::new); - } - - /** - * Sets the container's metadata. For more information, see the - * Azure Docs. - * - * @param metadata - * {@link Metadata} - * - * @return - * A reactive response signalling completion. - */ - public Mono setMetadata(Metadata metadata) { - return this.setMetadata(metadata, null, null); - } - - /** - * Sets the container's metadata. For more information, see the - * Azure Docs. - * - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link ContainerAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return - * A reactive response signalling completion. - */ - public Mono setMetadata(Metadata metadata, - ContainerAccessConditions accessConditions, Context context) { - return containerAsyncRawClient - .setMetadata(metadata, accessConditions, context) - .then(); - } - - /** - * Returns the container's permissions. The permissions indicate whether container's blobs may be accessed publicly. - * For more information, see the - * Azure Docs. - * - * @return - * A reactive response containing the container access policy. - */ - public Mono getAccessPolicy() { - return this.getAccessPolicy(null, null); - } - - /** - * Returns the container's permissions. The permissions indicate whether container's blobs may be accessed publicly. - * For more information, see the - * Azure Docs. - * - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return - * A reactive response containing the container access policy. - */ - public Mono getAccessPolicy(LeaseAccessConditions leaseAccessConditions, - Context context) { - return containerAsyncRawClient - .getAccessPolicy(leaseAccessConditions, context) - .map(ResponseBase::deserializedHeaders) - .map(ContainerGetAccessPolicyHeaders::blobPublicAccess); - } - - /** - * Sets the container's permissions. The permissions indicate whether blobs in a container may be accessed publicly. - * Note that, for each signed identifier, we will truncate the start and expiry times to the nearest second to - * ensure the time formatting is compatible with the service. For more information, see the - * Azure Docs. - * - * @param accessType - * Specifies how the data in this container is available to the public. See the x-ms-blob-public-access header - * in the Azure Docs for more information. Pass null for no public access. - * @param identifiers - * A list of {@link SignedIdentifier} objects that specify the permissions for the container. Please see - * here - * for more information. Passing null will clear all access policies. - * - * @return - * A reactive response signalling completion. - */ - public Mono setAccessPolicy(PublicAccessType accessType, - List identifiers) { - return this.setAccessPolicy(accessType, identifiers, null, null); - } - - /** - * Sets the container's permissions. The permissions indicate whether blobs in a container may be accessed publicly. - * Note that, for each signed identifier, we will truncate the start and expiry times to the nearest second to - * ensure the time formatting is compatible with the service. For more information, see the - * Azure Docs. - * - * @param accessType - * Specifies how the data in this container is available to the public. See the x-ms-blob-public-access header - * in the Azure Docs for more information. Pass null for no public access. - * @param identifiers - * A list of {@link SignedIdentifier} objects that specify the permissions for the container. Please see - * here - * for more information. Passing null will clear all access policies. - * @param accessConditions - * {@link ContainerAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return - * A reactive response signalling completion. - */ - public Mono setAccessPolicy(PublicAccessType accessType, - List identifiers, ContainerAccessConditions accessConditions, Context context) { - return containerAsyncRawClient - .setAccessPolicy(accessType, identifiers, accessConditions, context) - .then(); - } - - // TODO: figure out if this is meant to stay private or change to public - private boolean validateNoEtag(ModifiedAccessConditions modifiedAccessConditions) { - if (modifiedAccessConditions == null) { - return true; - } - return modifiedAccessConditions.ifMatch() == null && modifiedAccessConditions.ifNoneMatch() == null; - } - - - /** - * Returns a reactive Publisher emitting all the blobs in this container lazily as needed. - * - *

- * Blob names are returned in lexicographic order. For more information, see the - * Azure Docs. - * - * @return - * A reactive response emitting the flattened blobs. - */ - public Flux listBlobsFlat() { - return this.listBlobsFlat(new ListBlobsOptions(), null); - } - - /** - * Returns a reactive Publisher emitting all the blobs in this container lazily as needed. - * - *

- * Blob names are returned in lexicographic order. For more information, see the - * Azure Docs. - * - * @param options - * {@link ListBlobsOptions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return - * A reactive response emitting the listed blobs, flattened. - */ - public Flux listBlobsFlat(ListBlobsOptions options, Context context) { - return containerAsyncRawClient - .listBlobsFlatSegment(null, options, context) - .flatMapMany(response -> listBlobsFlatHelper(response.value().marker(), options, context, response)); - } - - private Flux listBlobsFlatHelper(String marker, ListBlobsOptions options, - Context context, ContainersListBlobFlatSegmentResponse response){ - Flux result = Flux.fromIterable(response.value().segment().blobItems()); - - if (response.value().nextMarker() != null) { - // Recursively add the continuation items to the observable. - result = result.concatWith(containerAsyncRawClient.listBlobsFlatSegment(marker, options, - context) - .flatMapMany((r) -> - listBlobsFlatHelper(response.value().nextMarker(), options, context, r))); - } - - return result; - } - - /** - * Returns a single segment of blobs and blob prefixes starting from the specified Marker. Use an empty - * marker to start enumeration from the beginning. Blob names are returned in lexicographic order. - * After getting a segment, process it, and then call ListBlobs again (passing the the previously-returned - * Marker) to get the next segment. For more information, see the - * Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListBlobsHierarchySegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param delimiter - * The operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs - * whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may - * be a single character or a string. - * @param options - * {@link ListBlobsOptions} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy "Sample code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy_helper "helper code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ -// public Flux listBlobsHierarchySegment(String marker, String delimiter, -// ListBlobsOptions options) { -// return this.listBlobsHierarchySegment(marker, delimiter, options, null); -// } - - /** - * Returns a single segment of blobs and blob prefixes starting from the specified Marker. Use an empty - * marker to start enumeration from the beginning. Blob names are returned in lexicographic order. - * After getting a segment, process it, and then call ListBlobs again (passing the the previously-returned - * Marker) to get the next segment. For more information, see the - * Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListBlobsHierarchySegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param delimiter - * The operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs - * whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may - * be a single character or a string. - * @param options - * {@link ListBlobsOptions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy "Sample code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy_helper "helper code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ -// public Flux listBlobsHierarchySegment(String marker, String delimiter, -// ListBlobsOptions options, Context context) { -// return containerAsyncRawClient -// .listBlobsHierarchySegment(null, delimiter, options, context) -// .flatMapMany(); -// } - - /** - * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 - * seconds, or infinite (-1). - * - * @param proposedId - * A {@code String} in any valid GUID format. May be null. - * @param duration - * The duration of the lease, in seconds, or negative one (-1) for a lease that - * never expires. A non-infinite lease can be between 15 and 60 seconds. - * - * @return - * A reactive response containing the lease ID. - */ - public Mono acquireLease(String proposedId, int duration) { - return this.acquireLease(proposedId, duration, null, null); - } - - /** - * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 - * seconds, or infinite (-1). - * - * @param proposedID - * A {@code String} in any valid GUID format. May be null. - * @param duration - * The duration of the lease, in seconds, or negative one (-1) for a lease that - * never expires. A non-infinite lease can be between 15 and 60 seconds. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the lease ID. - */ - public Mono acquireLease(String proposedID, int duration, ModifiedAccessConditions modifiedAccessConditions, - Context context) { - return containerAsyncRawClient - .acquireLease(proposedID, duration, modifiedAccessConditions, context) - .map(response -> response.deserializedHeaders().leaseId()); - } - - /** - * Renews the blob's previously-acquired lease. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * - * @return - * A reactive response containing the renewed lease ID. - */ - public Mono renewLease(String leaseID) { - return this.renewLease(leaseID, null, null); - } - - /** - * Renews the blob's previously-acquired lease. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the renewed lease ID. - */ - public Mono renewLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions, Context context) { - return containerAsyncRawClient - .renewLease(leaseID, modifiedAccessConditions, context) - .map(response -> response.deserializedHeaders().leaseId()); - } - - /** - * Releases the blob's previously-acquired lease. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * - * @return - * A reactive response signalling completion. - */ - public Mono releaseLease(String leaseID) { - return this.releaseLease(leaseID, null, null); - } - - /** - * Releases the blob's previously-acquired lease. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response signalling completion. - */ - public Mono releaseLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions, Context context) { - return containerAsyncRawClient - .releaseLease(leaseID, modifiedAccessConditions, context) - .then(); - } - - /** - * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant - * to break a fixed-duration lease when it expires or an infinite lease immediately. - * - * @return - * A reactive response containing the remaining time in the broken lease in seconds. - */ - public Mono breakLease() { - return this.breakLease(null, null, null); - } - - /** - * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant - * to break a fixed-duration lease when it expires or an infinite lease immediately. - * - * @param breakPeriodInSeconds - * An optional {@code Integer} representing the proposed duration of seconds that the lease should continue - * before it is broken, between 0 and 60 seconds. This break period is only used if it is shorter than the - * time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be - * available before the break period has expired, but the lease may be held for longer than the break - * period. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the remaining time in the broken lease in seconds. - */ - public Mono breakLease(Integer breakPeriodInSeconds, ModifiedAccessConditions modifiedAccessConditions, - Context context) { - return containerAsyncRawClient - .breakLease(breakPeriodInSeconds, modifiedAccessConditions, context) - .map(response -> response.deserializedHeaders().leaseTime()); - } - - /** - * ChangeLease changes the blob's lease ID. - * - * @param leaseId - * The leaseId of the active lease on the blob. - * @param proposedID - * A {@code String} in any valid GUID format. - * - * @return - * A reactive response containing the new lease ID. - */ - public Mono changeLease(String leaseId, String proposedID) { - return this.changeLease(leaseId, proposedID, null, null); - } - - /** - * ChangeLease changes the blob's lease ID. For more information, see the Azure Docs. - * - * @param leaseId - * The leaseId of the active lease on the blob. - * @param proposedID - * A {@code String} in any valid GUID format. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return A reactive response containing the new lease ID. - */ - public Mono changeLease(String leaseId, String proposedID, ModifiedAccessConditions modifiedAccessConditions, - Context context) { - return containerAsyncRawClient - .changeLease(leaseId, proposedID, modifiedAccessConditions, context) - .map(response -> response.deserializedHeaders().leaseId()); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the - * Azure Docs. - * - * @return - * A reactive response containing the account info. - */ - public Mono getAccountInfo() { - return this.getAccountInfo(null); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the - * Azure Docs. - * - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return - * A reactive response containing the account info. - */ - public Mono getAccountInfo(Context context) { - return containerAsyncRawClient - .getAccountInfo(context) - .map(ResponseBase::deserializedHeaders) - .map(StorageAccountInfo::new); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/ContainerAsyncRawClient.java b/storage/client/src/main/java/com/azure/storage/blob/ContainerAsyncRawClient.java deleted file mode 100644 index ad444cb837227..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/ContainerAsyncRawClient.java +++ /dev/null @@ -1,859 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.ContainersAcquireLeaseResponse; -import com.azure.storage.blob.models.ContainersBreakLeaseResponse; -import com.azure.storage.blob.models.ContainersChangeLeaseResponse; -import com.azure.storage.blob.models.ContainersCreateResponse; -import com.azure.storage.blob.models.ContainersDeleteResponse; -import com.azure.storage.blob.models.ContainersGetAccessPolicyResponse; -import com.azure.storage.blob.models.ContainersGetAccountInfoResponse; -import com.azure.storage.blob.models.ContainersGetPropertiesResponse; -import com.azure.storage.blob.models.ContainersListBlobFlatSegmentResponse; -import com.azure.storage.blob.models.ContainersListBlobHierarchySegmentResponse; -import com.azure.storage.blob.models.ContainersReleaseLeaseResponse; -import com.azure.storage.blob.models.ContainersRenewLeaseResponse; -import com.azure.storage.blob.models.ContainersSetAccessPolicyResponse; -import com.azure.storage.blob.models.ContainersSetMetadataResponse; -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.ModifiedAccessConditions; -import com.azure.storage.blob.models.PublicAccessType; -import com.azure.storage.blob.models.SignedIdentifier; -import reactor.core.publisher.Mono; - -import java.time.temporal.ChronoUnit; -import java.util.List; - -import static com.azure.storage.blob.Utility.postProcessResponse; - -/** - * Represents a URL to a container. It may be obtained by direct construction or via the create method on a - * {@link StorageAsyncRawClient} object. This class does not hold any state about a particular blob but is instead a convenient way - * of sending off appropriate requests to the resource on the service. It may also be used to construct URLs to blobs. - * Please refer to the - * Azure Docs - * for more information on containers. - */ -final class ContainerAsyncRawClient { - - public static final String ROOT_CONTAINER_NAME = "$root"; - - public static final String STATIC_WEBSITE_CONTAINER_NAME = "$web"; - - public static final String LOG_CONTAINER_NAME = "$logs"; - - AzureBlobStorageImpl azureBlobStorage; - - /** - * Creates a {@code ContainerAsyncClient} object pointing to the account specified by the URL and using the provided - * pipeline to make HTTP requests. - */ - ContainerAsyncRawClient(AzureBlobStorageImpl azureBlobStorage) { - this.azureBlobStorage = azureBlobStorage; - } - - /** - * Creates a new container within a storage account. If a container with the same name already exists, the operation - * fails. For more information, see the - * Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_basic "Sample code for ContainerAsyncClient.create")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono create() { - return this.create(null, null, null); - } - - /** - * Creates a new container within a storage account. If a container with the same name already exists, the operation - * fails. For more information, see the - * Azure Docs. - * - * @param metadata - * {@link Metadata} - * @param accessType - * Specifies how the data in this container is available to the public. See the x-ms-blob-public-access header - * in the Azure Docs for more information. Pass null for no public access. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_basic "Sample code for ContainerAsyncClient.create")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono create(Metadata metadata, PublicAccessType accessType, Context context) { - metadata = metadata == null ? new Metadata() : metadata; - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.containers().createWithRestResponseAsync( - null, null, metadata, accessType, null, context)); - - } - - /** - * Marks the specified container for deletion. The container and any blobs contained within it are later - * deleted during garbage collection. For more information, see the - * Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_basic "Sample code for ContainerAsyncClient.delete")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono delete() { - return this.delete(null, null); - } - - /** - * Marks the specified container for deletion. The container and any blobs contained within it are later - * deleted during garbage collection. For more information, see the - * Azure Docs. - * - * @param accessConditions - * {@link ContainerAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_basic "Sample code for ContainerAsyncClient.delete")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono delete(ContainerAccessConditions accessConditions, Context context) { - accessConditions = accessConditions == null ? new ContainerAccessConditions() : accessConditions; - context = context == null ? Context.NONE : context; - - if (!validateNoEtag(accessConditions.modifiedAccessConditions())) { - // Throwing is preferred to Single.error because this will error out immediately instead of waiting until - // subscription. - throw new UnsupportedOperationException("ETag access conditions are not supported for this API."); - } - - return postProcessResponse(this.azureBlobStorage.containers() - .deleteWithRestResponseAsync(null, null, null, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), context)); - } - - /** - * Returns the container's metadata and system properties. For more information, see the - * Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_basic "Sample code for ContainerAsyncClient.getProperties")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getProperties() { - return this.getProperties(null, null); - } - - /** - * Returns the container's metadata and system properties. For more information, see the - * Azure Docs. - * - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_basic "Sample code for ContainerAsyncClient.getProperties")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getProperties(LeaseAccessConditions leaseAccessConditions, - Context context) { - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.containers() - .getPropertiesWithRestResponseAsync(null, null, null, - leaseAccessConditions, context)); - } - - /** - * Sets the container's metadata. For more information, see the - * Azure Docs. - * - * @param metadata - * {@link Metadata} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_basic "Sample code for ContainerAsyncClient.setMetadata")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono setMetadata(Metadata metadata) { - return this.setMetadata(metadata, null, null); - } - - /** - * Sets the container's metadata. For more information, see the - * Azure Docs. - * - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link ContainerAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_basic "Sample code for ContainerAsyncClient.setMetadata")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono setMetadata(Metadata metadata, - ContainerAccessConditions accessConditions, Context context) { - metadata = metadata == null ? new Metadata() : metadata; - accessConditions = accessConditions == null ? new ContainerAccessConditions() : accessConditions; - context = context == null ? Context.NONE : context; - if (!validateNoEtag(accessConditions.modifiedAccessConditions()) - || accessConditions.modifiedAccessConditions().ifUnmodifiedSince() != null) { - // Throwing is preferred to Single.error because this will error out immediately instead of waiting until - // subscription. - throw new UnsupportedOperationException( - "If-Modified-Since is the only HTTP access condition supported for this API"); - } - - return postProcessResponse(this.azureBlobStorage.containers() - .setMetadataWithRestResponseAsync(null, null, metadata, null, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), context)); - } - - /** - * Returns the container's permissions. The permissions indicate whether container's blobs may be accessed publicly. - * For more information, see the - * Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_policy "Sample code for ContainerAsyncClient.getAccessPolicy")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getAccessPolicy() { - return this.getAccessPolicy(null, null); - } - - /** - * Returns the container's permissions. The permissions indicate whether container's blobs may be accessed publicly. - * For more information, see the - * Azure Docs. - * - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_policy "Sample code for ContainerAsyncClient.getAccessPolicy")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getAccessPolicy(LeaseAccessConditions leaseAccessConditions, - Context context) { - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.containers().getAccessPolicyWithRestResponseAsync( - null, null, null, leaseAccessConditions, context)); - } - - /** - * Sets the container's permissions. The permissions indicate whether blobs in a container may be accessed publicly. - * Note that, for each signed identifier, we will truncate the start and expiry times to the nearest second to - * ensure the time formatting is compatible with the service. For more information, see the - * Azure Docs. - * - * @param accessType - * Specifies how the data in this container is available to the public. See the x-ms-blob-public-access header - * in the Azure Docs for more information. Pass null for no public access. - * @param identifiers - * A list of {@link SignedIdentifier} objects that specify the permissions for the container. Please see - * here - * for more information. Passing null will clear all access policies. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_policy "Sample code for ContainerAsyncClient.setAccessPolicy")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono setAccessPolicy(PublicAccessType accessType, - List identifiers) { - return this.setAccessPolicy(accessType, identifiers, null, null); - } - - /** - * Sets the container's permissions. The permissions indicate whether blobs in a container may be accessed publicly. - * Note that, for each signed identifier, we will truncate the start and expiry times to the nearest second to - * ensure the time formatting is compatible with the service. For more information, see the - * Azure Docs. - * - * @param accessType - * Specifies how the data in this container is available to the public. See the x-ms-blob-public-access header - * in the Azure Docs for more information. Pass null for no public access. - * @param identifiers - * A list of {@link SignedIdentifier} objects that specify the permissions for the container. Please see - * here - * for more information. Passing null will clear all access policies. - * @param accessConditions - * {@link ContainerAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_policy "Sample code for ContainerAsyncClient.setAccessPolicy")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono setAccessPolicy(PublicAccessType accessType, - List identifiers, ContainerAccessConditions accessConditions, Context context) { - accessConditions = accessConditions == null ? new ContainerAccessConditions() : accessConditions; - context = context == null ? Context.NONE : context; - - if (!validateNoEtag(accessConditions.modifiedAccessConditions())) { - // Throwing is preferred to Single.error because this will error out immediately instead of waiting until - // subscription. - throw new UnsupportedOperationException("ETag access conditions are not supported for this API."); - } - - /* - We truncate to seconds because the service only supports nanoseconds or seconds, but doing an - OffsetDateTime.now will only give back milliseconds (more precise fields are zeroed and not serialized). This - allows for proper serialization with no real detriment to users as sub-second precision on active time for - signed identifiers is not really necessary. - */ - if (identifiers != null) { - for (SignedIdentifier identifier : identifiers) { - if (identifier.accessPolicy() != null && identifier.accessPolicy().start() != null) { - identifier.accessPolicy().start( - identifier.accessPolicy().start().truncatedTo(ChronoUnit.SECONDS)); - } - if (identifier.accessPolicy() != null && identifier.accessPolicy().expiry() != null) { - identifier.accessPolicy().expiry( - identifier.accessPolicy().expiry().truncatedTo(ChronoUnit.SECONDS)); - } - } - } - - return postProcessResponse(this.azureBlobStorage.containers() - .setAccessPolicyWithRestResponseAsync(null, identifiers, null, accessType, - null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), - context)); - - } - - private boolean validateNoEtag(ModifiedAccessConditions modifiedAccessConditions) { - if (modifiedAccessConditions == null) { - return true; - } - return modifiedAccessConditions.ifMatch() == null && modifiedAccessConditions.ifNoneMatch() == null; - } - - /** - * Acquires a lease on the container for delete operations. The lease duration must be between 15 to - * 60 seconds, or infinite (-1). For more information, see the - * Azure Docs. - * - * @apiNote - * ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.acquireLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/New-Storage-SDK-V10-Preview/src/test/java/com/microsoft/azure/storage/Samples.java) - * - * @param proposedId - * A {@code String} in any valid GUID format. - * @param duration - * The duration of the lease, in seconds, or negative one (-1) for a lease that never expires. - * A non-infinite lease can be between 15 and 60 seconds. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.acquireLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono acquireLease(String proposedId, int duration) { - return this.acquireLease(proposedId, duration, null, null); - } - - /** - * Acquires a lease on the container for delete operations. The lease duration must be between 15 to - * 60 seconds, or infinite (-1). For more information, see the - * Azure Docs. - * - * @param proposedID - * A {@code String} in any valid GUID format. - * @param duration - * The duration of the lease, in seconds, or negative one (-1) for a lease that never expires. - * A non-infinite lease can be between 15 and 60 seconds. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.acquireLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono acquireLease(String proposedID, int duration, - ModifiedAccessConditions modifiedAccessConditions, Context context) { - if (!this.validateNoEtag(modifiedAccessConditions)) { - // Throwing is preferred to Single.error because this will error out immediately instead of waiting until - // subscription. - throw new UnsupportedOperationException( - "ETag access conditions are not supported for this API."); - } - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.containers().acquireLeaseWithRestResponseAsync( - null, null, duration, proposedID, null, modifiedAccessConditions, context)); - } - - /** - * Renews the container's previously-acquired lease. For more information, see the - * Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the container. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.renewLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono renewLease(String leaseID) { - return this.renewLease(leaseID, null, null); - } - - /** - * Renews the container's previously-acquired lease. For more information, see the - * Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the container. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.renewLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono renewLease(String leaseID, - ModifiedAccessConditions modifiedAccessConditions, Context context) { - if (!this.validateNoEtag(modifiedAccessConditions)) { - // Throwing is preferred to Single.error because this will error out immediately instead of waiting until - // subscription. - throw new UnsupportedOperationException( - "ETag access conditions are not supported for this API."); - } - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.containers().renewLeaseWithRestResponseAsync(null, - leaseID, null, null, modifiedAccessConditions, context)); - } - - /** - * Releases the container's previously-acquired lease. For more information, see the - * Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the container. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.releaseLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono releaseLease(String leaseID) { - return this.releaseLease(leaseID, null, null); - } - - /** - * Releases the container's previously-acquired lease. For more information, see the - * Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the container. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.releaseLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono releaseLease(String leaseID, - ModifiedAccessConditions modifiedAccessConditions, Context context) { - if (!this.validateNoEtag(modifiedAccessConditions)) { - // Throwing is preferred to Single.error because this will error out immediately instead of waiting until - // subscription. - throw new UnsupportedOperationException( - "ETag access conditions are not supported for this API."); - } - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.containers().releaseLeaseWithRestResponseAsync( - null, leaseID, null, null, modifiedAccessConditions, context)); - } - - /** - * Breaks the container's previously-acquired lease. For more information, see the - * Azure Docs. - * - * @apiNote - * ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.breakLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/New-Storage-SDK-V10-Preview/src/test/java/com/microsoft/azure/storage/Samples.java) - * - * @return Emits the successful response. - */ - public Mono breakLease() { - return this.breakLease(null, null, null); - } - - /** - * Breaks the container's previously-acquired lease. For more information, see the - * Azure Docs. - * - * @param breakPeriodInSeconds - * An optional {@code Integer} representing the proposed duration of seconds that the lease should continue - * before it is broken, between 0 and 60 seconds. This break period is only used if it is shorter than the time - * remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be - * available before the break period has expired, but the lease may be held for longer than the break period. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.breakLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono breakLease(Integer breakPeriodInSeconds, - ModifiedAccessConditions modifiedAccessConditions, Context context) { - if (!this.validateNoEtag(modifiedAccessConditions)) { - // Throwing is preferred to Single.error because this will error out immediately instead of waiting until - // subscription. - throw new UnsupportedOperationException( - "ETag access conditions are not supported for this API."); - } - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.containers().breakLeaseWithRestResponseAsync(null, - null, breakPeriodInSeconds, null, modifiedAccessConditions, context)); - - } - - /** - * Changes the container's leaseAccessConditions. For more information, see the - * Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the container. - * @param proposedID - * A {@code String} in any valid GUID format. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.changeLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono changeLease(String leaseID, String proposedID) { - return this.changeLease(leaseID, proposedID, null, null); - } - - /** - * Changes the container's leaseAccessConditions. For more information, see the - * Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the container. - * @param proposedID - * A {@code String} in any valid GUID format. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.changeLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono changeLease(String leaseID, String proposedID, - ModifiedAccessConditions modifiedAccessConditions, Context context) { - if (!this.validateNoEtag(modifiedAccessConditions)) { - // Throwing is preferred to Single.error because this will error out immediately instead of waiting until - // subscription. - throw new UnsupportedOperationException( - "ETag access conditions are not supported for this API."); - } - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.containers().changeLeaseWithRestResponseAsync(null, - leaseID, proposedID, null, null, modifiedAccessConditions, context)); - } - - /** - * Returns a single segment of blobs starting from the specified Marker. Use an empty - * marker to start enumeration from the beginning. Blob names are returned in lexicographic order. - * After getting a segment, process it, and then call ListBlobs again (passing the the previously-returned - * Marker) to get the next segment. For more information, see the - * Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListBlobsFlatSegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param options - * {@link ListBlobsOptions} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_flat "Sample code for ContainerAsyncClient.listBlobsFlatSegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_flat_helper "helper code for ContainerAsyncClient.listBlobsFlatSegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono listBlobsFlatSegment(String marker, ListBlobsOptions options) { - return this.listBlobsFlatSegment(marker, options, null); - } - - /** - * Returns a single segment of blobs starting from the specified Marker. Use an empty - * marker to start enumeration from the beginning. Blob names are returned in lexicographic order. - * After getting a segment, process it, and then call ListBlobs again (passing the the previously-returned - * Marker) to get the next segment. For more information, see the - * Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListBlobsFlatSegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param options - * {@link ListBlobsOptions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_flat "Sample code for ContainerAsyncClient.listBlobsFlatSegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_flat_helper "helper code for ContainerAsyncClient.listBlobsFlatSegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono listBlobsFlatSegment(String marker, ListBlobsOptions options, - Context context) { - options = options == null ? new ListBlobsOptions() : options; - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.containers() - .listBlobFlatSegmentWithRestResponseAsync(null, options.prefix(), marker, - options.maxResults(), options.details().toList(), null, null, context)); - } - - /** - * Returns a single segment of blobs and blob prefixes starting from the specified Marker. Use an empty - * marker to start enumeration from the beginning. Blob names are returned in lexicographic order. - * After getting a segment, process it, and then call ListBlobs again (passing the the previously-returned - * Marker) to get the next segment. For more information, see the - * Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListBlobsHierarchySegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param delimiter - * The operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs - * whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may - * be a single character or a string. - * @param options - * {@link ListBlobsOptions} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy "Sample code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy_helper "helper code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono listBlobsHierarchySegment(String marker, String delimiter, - ListBlobsOptions options) { - return this.listBlobsHierarchySegment(marker, delimiter, options, null); - } - - /** - * Returns a single segment of blobs and blob prefixes starting from the specified Marker. Use an empty - * marker to start enumeration from the beginning. Blob names are returned in lexicographic order. - * After getting a segment, process it, and then call ListBlobs again (passing the the previously-returned - * Marker) to get the next segment. For more information, see the - * Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListBlobsHierarchySegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param delimiter - * The operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs - * whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may - * be a single character or a string. - * @param options - * {@link ListBlobsOptions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy "Sample code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy_helper "helper code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono listBlobsHierarchySegment(String marker, String delimiter, - ListBlobsOptions options, Context context) { - options = options == null ? new ListBlobsOptions() : options; - if (options.details().snapshots()) { - throw new UnsupportedOperationException("Including snapshots in a hierarchical listing is not supported."); - } - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.containers() - .listBlobHierarchySegmentWithRestResponseAsync(null, delimiter, options.prefix(), marker, - options.maxResults(), options.details().toList(), null, null, context)); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the - * Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=account_info "Sample code for ContainerAsyncClient.getAccountInfo")] \n - * For more samples, please see the [Samples file] (https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getAccountInfo() { - return this.getAccountInfo(null); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the - * Azure Docs. - * - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=account_info "Sample code for ContainerAsyncClient.getAccountInfo")] \n - * For more samples, please see the [Samples file] (https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getAccountInfo(Context context) { - context = context == null ? Context.NONE : context; - - return postProcessResponse( - this.azureBlobStorage.containers().getAccountInfoWithRestResponseAsync(null, context)); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/ContainerClient.java b/storage/client/src/main/java/com/azure/storage/blob/ContainerClient.java deleted file mode 100644 index 24d96c410d830..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/ContainerClient.java +++ /dev/null @@ -1,746 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.util.Context; -import com.azure.storage.blob.models.BlobItem; -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.ModifiedAccessConditions; -import com.azure.storage.blob.models.PublicAccessType; -import com.azure.storage.blob.models.SignedIdentifier; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.net.MalformedURLException; -import java.net.URL; -import java.time.Duration; -import java.util.List; - -/** - * Client to a container. It may only be instantiated through a {@link ContainerClientBuilder} or via the method - * {@link StorageClient#getContainerClient(String)}. This class does not hold any - * state about a particular container but is instead a convenient way of sending off appropriate requests to - * the resource on the service. It may also be used to construct URLs to blobs. - * - *

- * This client contains operations on a container. Operations on a blob are available on {@link BlobClient} through - * {@link #getBlobClient(String)}, and operations on the service are available on {@link StorageClient}. - * - *

- * Please refer to the Azure Docs - * for more information on containers. - */ -public final class ContainerClient { - - private ContainerAsyncClient containerAsyncClient; - private ContainerClientBuilder builder; - - public static final String ROOT_CONTAINER_NAME = "$root"; - - public static final String STATIC_WEBSITE_CONTAINER_NAME = "$web"; - - public static final String LOG_CONTAINER_NAME = "$logs"; - - /** - * Package-private constructor for use by {@link ContainerClientBuilder}. - * @param builder the container client builder - */ - ContainerClient(ContainerClientBuilder builder) { - this.builder = builder; - this.containerAsyncClient = new ContainerAsyncClient(builder); - } - - /** - * @return a new client {@link ContainerClientBuilder} instance. - */ - public static ContainerClientBuilder containerClientBuilder() { - return new ContainerClientBuilder(); - } - - /** - * Creates a new {@link BlockBlobClient} object by concatenating the blobName to the end of - * ContainerAsyncClient's URL. The new BlockBlobClient uses the same request policy pipeline as the ContainerAsyncClient. - * To change the pipeline, create the BlockBlobClient and then call its WithPipeline method passing in the - * desired pipeline object. Or, call this package's NewBlockBlobAsyncClient instead of calling this object's - * NewBlockBlobAsyncClient method. - * - * @param blobName - * A {@code String} representing the name of the blob. - * - * @return A new {@link BlockBlobClient} object which references the blob with the specified name in this container. - */ - public BlockBlobClient getBlockBlobClient(String blobName) { - try { - return new BlockBlobClient(this.builder.copyBuilder().endpoint(Utility.appendToURLPath(new URL(builder.endpoint()), blobName).toString()).buildImpl()); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - - /** - * Creates creates a new PageBlobClient object by concatenating blobName to the end of - * ContainerAsyncClient's URL. The new PageBlobClient uses the same request policy pipeline as the ContainerAsyncClient. - * To change the pipeline, create the PageBlobClient and then call its WithPipeline method passing in the - * desired pipeline object. Or, call this package's NewPageBlobAsyncClient instead of calling this object's - * NewPageBlobAsyncClient method. - * - * @param blobName - * A {@code String} representing the name of the blob. - * - * @return A new {@link PageBlobClient} object which references the blob with the specified name in this container. - */ - public PageBlobClient getPageBlobClient(String blobName) { - try { - return new PageBlobClient(this.builder.copyBuilder().endpoint(Utility.appendToURLPath(new URL(builder.endpoint()), blobName).toString()).buildImpl()); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - - /** - * Creates creates a new AppendBlobClient object by concatenating blobName to the end of - * ContainerAsyncClient's URL. The new AppendBlobClient uses the same request policy pipeline as the ContainerAsyncClient. - * To change the pipeline, create the AppendBlobClient and then call its WithPipeline method passing in the - * desired pipeline object. Or, call this package's NewAppendBlobAsyncClient instead of calling this object's - * NewAppendBlobAsyncClient method. - * - * @param blobName - * A {@code String} representing the name of the blob. - * - * @return A new {@link AppendBlobClient} object which references the blob with the specified name in this container. - */ - public AppendBlobClient getAppendBlobClient(String blobName) { - try { - return new AppendBlobClient(this.builder.copyBuilder().endpoint(Utility.appendToURLPath(new URL(builder.endpoint()), blobName).toString()).buildImpl()); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - - /** - * Initializes a new BlobClient object by concatenating blobName to the end of - * ContainerAsyncClient's URL. The new BlobClient uses the same request policy pipeline as the ContainerAsyncClient. - * To change the pipeline, create the BlobClient and then call its WithPipeline method passing in the - * desired pipeline object. Or, call this package's getBlobAsyncClient instead of calling this object's - * getBlobAsyncClient method. - * - * @param blobName - * A {@code String} representing the name of the blob. - * - * @return A new {@link BlobClient} object which references the blob with the specified name in this container. - */ - public BlobClient getBlobClient(String blobName) { - try { - return new BlobClient(this.builder.copyBuilder().endpoint(Utility.appendToURLPath(new URL(builder.endpoint()), blobName).toString()).buildImpl()); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - - /** - * Creates a new container within a storage account. If a container with the same name already exists, the operation - * fails. For more information, see the - * Azure Docs. - */ - public void create() { - this.create(null, null, null, null); - } - - /** - * Creates a new container within a storage account. If a container with the same name already exists, the operation - * fails. For more information, see the - * Azure Docs. - * - * @param metadata - * {@link Metadata} - * @param accessType - * Specifies how the data in this container is available to the public. See the x-ms-blob-public-access header - * in the Azure Docs for more information. Pass null for no public access. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - */ - public void create(Metadata metadata, PublicAccessType accessType, Duration timeout, Context context) { - Mono response = containerAsyncClient.create(metadata, accessType, context); - - if (timeout == null) { - response.block(); - } else { - response.block(timeout); - } - } - - /** - * Marks the specified container for deletion. The container and any blobs contained within it are later - * deleted during garbage collection. For more information, see the - * Azure Docs. - */ - public void delete() { - this.delete(null, null, null); - } - - /** - * Marks the specified container for deletion. The container and any blobs contained within it are later - * deleted during garbage collection. For more information, see the - * Azure Docs. - * - * @param accessConditions - * {@link ContainerAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - */ - public void delete(ContainerAccessConditions accessConditions, Duration timeout, Context context) { - Mono response = containerAsyncClient.delete(accessConditions, context); - - if (timeout == null) { - response.block(); - } else { - response.block(timeout); - } - } - - /** - * Returns the container's metadata and system properties. For more information, see the - * Azure Docs. - * - * @return - * The container properties. - */ - public ContainerProperties getProperties() { - return this.getProperties(null, null, null); - } - - /** - * Returns the container's metadata and system properties. For more information, see the - * Azure Docs. - * - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return - * The container properties. - */ - public ContainerProperties getProperties(LeaseAccessConditions leaseAccessConditions, - Duration timeout, Context context) { - Mono response = containerAsyncClient.getProperties(leaseAccessConditions, context); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Sets the container's metadata. For more information, see the - * Azure Docs. - * - * @param metadata - * {@link Metadata} - */ - public void setMetadata(Metadata metadata) { - this.setMetadata(metadata, null, null, null); - } - - /** - * Sets the container's metadata. For more information, see the - * Azure Docs. - * - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link ContainerAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - */ - public void setMetadata(Metadata metadata, - ContainerAccessConditions accessConditions, Duration timeout, Context context) { - Mono response = containerAsyncClient.setMetadata(metadata, accessConditions, context); - - if (timeout == null) { - response.block(); - } else { - response.block(timeout); - } - } - - /** - * Returns the container's permissions. The permissions indicate whether container's blobs may be accessed publicly. - * For more information, see the - * Azure Docs. - * - * @return - * The container access policy. - */ - public PublicAccessType getAccessPolicy() { - return this.getAccessPolicy(null, null, null); - } - - /** - * Returns the container's permissions. The permissions indicate whether container's blobs may be accessed publicly. - * For more information, see the - * Azure Docs. - * - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return - * The container access policy. - */ - public PublicAccessType getAccessPolicy(LeaseAccessConditions leaseAccessConditions, - Duration timeout, Context context) { - Mono response = containerAsyncClient.getAccessPolicy(leaseAccessConditions, context); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Sets the container's permissions. The permissions indicate whether blobs in a container may be accessed publicly. - * Note that, for each signed identifier, we will truncate the start and expiry times to the nearest second to - * ensure the time formatting is compatible with the service. For more information, see the - * Azure Docs. - * - * @param accessType - * Specifies how the data in this container is available to the public. See the x-ms-blob-public-access header - * in the Azure Docs for more information. Pass null for no public access. - * @param identifiers - * A list of {@link SignedIdentifier} objects that specify the permissions for the container. Please see - * here - * for more information. Passing null will clear all access policies. - */ - public void setAccessPolicy(PublicAccessType accessType, - List identifiers) { - this.setAccessPolicy(accessType, identifiers, null, null,null); - } - - /** - * Sets the container's permissions. The permissions indicate whether blobs in a container may be accessed publicly. - * Note that, for each signed identifier, we will truncate the start and expiry times to the nearest second to - * ensure the time formatting is compatible with the service. For more information, see the - * Azure Docs. - * - * @param accessType - * Specifies how the data in this container is available to the public. See the x-ms-blob-public-access header - * in the Azure Docs for more information. Pass null for no public access. - * @param identifiers - * A list of {@link SignedIdentifier} objects that specify the permissions for the container. Please see - * here - * for more information. Passing null will clear all access policies. - * @param accessConditions - * {@link ContainerAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - */ - public void setAccessPolicy(PublicAccessType accessType, - List identifiers, ContainerAccessConditions accessConditions, - Duration timeout, Context context) { - Mono response = containerAsyncClient.setAccessPolicy(accessType, identifiers, accessConditions, context); - - if (timeout == null) { - response.block(); - } else { - response.block(timeout); - } - } - - /** - * Returns a lazy loaded list of blobs in this container, with folder structures flattened. - * The returned {@link Iterable} can be iterated through while new items are automatically - * retrieved as needed. - * - *

- * Blob names are returned in lexicographic order. - * - *

- * For more information, see the - * Azure Docs. - * - * @return - * The listed blobs, flattened. - */ - public Iterable listBlobsFlat() { - return this.listBlobsFlat(new ListBlobsOptions(), null, null); - } - - /** - * Returns a lazy loaded list of blobs in this container, with folder structures flattened. - * The returned {@link Iterable} can be iterated through while new items are automatically - * retrieved as needed. - * - *

- * Blob names are returned in lexicographic order. - * - *

- * For more information, see the - * Azure Docs. - * - * @param options - * {@link ListBlobsOptions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return - * The listed blobs, flattened. - */ - public Iterable listBlobsFlat(ListBlobsOptions options, Duration timeout, Context context) { - Flux response = containerAsyncClient.listBlobsFlat(options, context); - - return timeout == null ? - response.toIterable(): - response.timeout(timeout).toIterable(); - } - - /** - * Returns a single segment of blobs and blob prefixes starting from the specified Marker. Use an empty - * marker to start enumeration from the beginning. Blob names are returned in lexicographic order. - * After getting a segment, process it, and then call ListBlobs again (passing the the previously-returned - * Marker) to get the next segment. For more information, see the - * Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListBlobsHierarchySegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param delimiter - * The operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs - * whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may - * be a single character or a string. - * @param options - * {@link ListBlobsOptions} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy "Sample code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy_helper "helper code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ -// public Iterable listBlobsHierarchySegment(String marker, String delimiter, -// ListBlobsOptions options) { -// return this.listBlobsHierarchySegment(marker, delimiter, options, null, null); -// } - - /** - * Returns a single segment of blobs and blob prefixes starting from the specified Marker. Use an empty - * marker to start enumeration from the beginning. Blob names are returned in lexicographic order. - * After getting a segment, process it, and then call ListBlobs again (passing the the previously-returned - * Marker) to get the next segment. For more information, see the - * Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListBlobsHierarchySegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param delimiter - * The operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs - * whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may - * be a single character or a string. - * @param options - * {@link ListBlobsOptions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy "Sample code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy_helper "helper code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ -// public Iterable listBlobsHierarchySegment(String marker, String delimiter, -// ListBlobsOptions options, Duration timeout, Context context) { -// Flux response = containerAsyncClient.listBlobsHierarchySegment(marker, delimiter, options, context); -// -// return timeout == null ? -// response.toIterable(): -// response.timeout(timeout).toIterable(); -// } - - /** - * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 - * seconds, or infinite (-1). - * - * @param proposedId - * A {@code String} in any valid GUID format. May be null. - * @param duration - * The duration of the lease, in seconds, or negative one (-1) for a lease that - * never expires. A non-infinite lease can be between 15 and 60 seconds. - * - * @return - * The lease ID. - */ - public String acquireLease(String proposedId, int duration) { - return this.acquireLease(proposedId, duration, null, null); - } - - /** - * Acquires a lease on the blob for write and delete operations. The lease duration must be between 15 to 60 - * seconds, or infinite (-1). - * - * @param proposedID - * A {@code String} in any valid GUID format. May be null. - * @param duration - * The duration of the lease, in seconds, or negative one (-1) for a lease that - * never expires. A non-infinite lease can be between 15 and 60 seconds. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The lease ID. - */ - public String acquireLease(String proposedID, int duration, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono response = containerAsyncClient - .acquireLease(proposedID, duration, modifiedAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Renews the blob's previously-acquired lease. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * - * @return - * The renewed lease ID. - */ - public String renewLease(String leaseID) { - return this.renewLease(leaseID, null, null); - } - - /** - * Renews the blob's previously-acquired lease. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The renewed lease ID. - */ - public String renewLease(String leaseID, ModifiedAccessConditions modifiedAccessConditions, - Duration timeout) { - Mono response = containerAsyncClient - .renewLease(leaseID, modifiedAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Releases the blob's previously-acquired lease. - * - * @param leaseID - * The leaseId of the active lease on the blob. - */ - public void releaseLease(String leaseID) { - this.releaseLease(leaseID, null, null); - } - - /** - * Releases the blob's previously-acquired lease. - * - * @param leaseID - * The leaseId of the active lease on the blob. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - */ - public void releaseLease(String leaseID, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono response = containerAsyncClient - .releaseLease(leaseID, modifiedAccessConditions, null /*context*/); - - if (timeout == null) { - response.block(); - } else { - response.block(timeout); - } - } - - /** - * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant - * to break a fixed-duration lease when it expires or an infinite lease immediately. - * - * @return - * The remaining time in the broken lease in seconds. - */ - public int breakLease() { - return this.breakLease(null, null, null); - } - - /** - * BreakLease breaks the blob's previously-acquired lease (if it exists). Pass the LeaseBreakDefault (-1) constant - * to break a fixed-duration lease when it expires or an infinite lease immediately. - * - * @param breakPeriodInSeconds - * An optional {@code Integer} representing the proposed duration of seconds that the lease should continue - * before it is broken, between 0 and 60 seconds. This break period is only used if it is shorter than the - * time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be - * available before the break period has expired, but the lease may be held for longer than the break - * period. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The remaining time in the broken lease in seconds. - */ - public int breakLease(Integer breakPeriodInSeconds, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono response = containerAsyncClient - .breakLease(breakPeriodInSeconds, modifiedAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * ChangeLease changes the blob's lease ID. - * - * @param leaseId - * The leaseId of the active lease on the blob. - * @param proposedID - * A {@code String} in any valid GUID format. - * - * @return - * The new lease ID. - */ - public String changeLease(String leaseId, String proposedID) { - return this.changeLease(leaseId, proposedID, null, null); - } - - /** - * ChangeLease changes the blob's lease ID. For more information, see the Azure Docs. - * - * @param leaseId - * The leaseId of the active lease on the blob. - * @param proposedID - * A {@code String} in any valid GUID format. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return The new lease ID. - */ - public String changeLease(String leaseId, String proposedID, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout) { - Mono response = containerAsyncClient - .changeLease(leaseId, proposedID, modifiedAccessConditions, null /*context*/); - - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the - * Azure Docs. - * - * @return - * The account info. - */ - public StorageAccountInfo getAccountInfo() { - return this.getAccountInfo(null, null); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the - * Azure Docs. - * - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return - * The account info. - */ - public StorageAccountInfo getAccountInfo(Duration timeout, Context context) { - Mono response = containerAsyncClient.getAccountInfo(context); - - return timeout == null ? - response.block(): - response.block(timeout); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java b/storage/client/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java deleted file mode 100644 index ff5f80ddc3ccc..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/ContainerClientBuilder.java +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.util.configuration.Configuration; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLoggingPolicy; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.implementation.util.ImplUtils; -import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * Fluent ContainerClientBuilder for instantiating a {@link ContainerClient} or {@link ContainerAsyncClient}. - * - *

- * An instance of this builder may only be created from static method {@link ContainerClient#containerClientBuilder()}. - * The following information must be provided on this builder: - * - *

    - *
  • the endpoint through {@code .endpoint()}, including the container name, in the format of {@code https://{accountName}.blob.core.windows.net/{containerName}}. - *
  • the credential through {@code .credentials()} or {@code .connectionString()} if the container is not publicly accessible. - *
- * - *

- * Once all the configurations are set on this builder, call {@code .buildClient()} to create a - * {@link ContainerClient} or {@code .buildAsyncClient()} to create a {@link ContainerAsyncClient}. - */ -public final class ContainerClientBuilder { - private static final String ACCOUNT_NAME = "AccountName".toLowerCase(); - private static final String ACCOUNT_KEY = "AccountKey".toLowerCase(); - - private final List policies; - - private URL endpoint; - private ICredentials credentials = new AnonymousCredentials(); - private HttpClient httpClient; - private HttpLogDetailLevel logLevel; - private RetryPolicy retryPolicy; - private Configuration configuration; - - public ContainerClientBuilder() { - retryPolicy = new RetryPolicy(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); - } - - ContainerClientBuilder(List policies, URL endpoint, ICredentials credentials, - HttpClient httpClient, HttpLogDetailLevel logLevel, RetryPolicy retryPolicy, Configuration configuration) { - this.policies = policies; - this.endpoint = endpoint; - this.credentials = credentials; - this.httpClient = httpClient; - this.logLevel = logLevel; - this.retryPolicy = retryPolicy; - this.configuration = configuration; - } - - ContainerClientBuilder copyBuilder() { - return new ContainerClientBuilder(this.policies, this.endpoint, this.credentials, this.httpClient, this.logLevel, this.retryPolicy, this.configuration); - } - - /** - * Constructs an instance of ContainerAsyncClient based on the configurations stored in the appendBlobClientBuilder. - * @return a new client instance - */ - AzureBlobStorageImpl buildImpl() { - Objects.requireNonNull(endpoint); - - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - policies.add(new UserAgentPolicy(BlobConfiguration.NAME, BlobConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - policies.add(credentials); // This needs to be a different credential type. - - policies.add(retryPolicy); - - policies.addAll(this.policies); - policies.add(new HttpLoggingPolicy(logLevel)); - - HttpPipeline pipeline = HttpPipeline.builder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); - - return new AzureBlobStorageBuilder() - .url(endpoint.toString()) - .pipeline(pipeline) - .build(); - } - - /** - * @return a {@link ContainerClient} created from the configurations in this builder. - */ - public ContainerClient buildClient() { - return new ContainerClient(this); - } - - /** - * @return a {@link ContainerAsyncClient} created from the configurations in this builder. - */ - public ContainerAsyncClient buildAsyncClient() { - return new ContainerAsyncClient(this); - } - - /** - * Sets the service endpoint, additionally parses it for information (SAS token, container name) - * @param endpoint URL of the service - * @return the updated ContainerClientBuilder object - */ - public ContainerClientBuilder endpoint(String endpoint) { - Objects.requireNonNull(endpoint); - try { - this.endpoint = new URL(endpoint); - } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage Queue endpoint url is malformed."); - } - - return this; - } - - String endpoint() { - return this.endpoint.toString(); - } - - /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials - * @return the updated ContainerClientBuilder object - */ - public ContainerClientBuilder credentials(SharedKeyCredentials credentials) { - this.credentials = credentials; - return this; - } - - /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials - * @return the updated ContainerClientBuilder object - */ - public ContainerClientBuilder credentials(TokenCredentials credentials) { - this.credentials = credentials; - return this; - } - - /** - * Clears the credentials used to authorize requests sent to the service - * @return the updated ContainerClientBuilder object - */ - public ContainerClientBuilder anonymousCredentials() { - this.credentials = new AnonymousCredentials(); - return this; - } - - /** - * Sets the connection string for the service, parses it for authentication information (account name, account key) - * @param connectionString connection string from access keys section - * @return the updated ContainerClientBuilder object - */ - public ContainerClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - - Map connectionKVPs = new HashMap<>(); - for (String s : connectionString.split(";")) { - String[] kvp = s.split("=", 2); - connectionKVPs.put(kvp[0].toLowerCase(), kvp[1]); - } - - String accountName = connectionKVPs.get(ACCOUNT_NAME); - String accountKey = connectionKVPs.get(ACCOUNT_KEY); - - if (ImplUtils.isNullOrEmpty(accountName) || ImplUtils.isNullOrEmpty(accountKey)) { - throw new IllegalArgumentException("Connection string must contain 'AccountName' and 'AccountKey'."); - } - - // Use accountName and accountKey to get the SAS token using the credential class. - credentials = new SharedKeyCredentials(accountName, accountKey); - - return this; - } - - /** - * Sets the http client used to send service requests - * @param httpClient http client to send requests - * @return the updated ContainerClientBuilder object - */ - public ContainerClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /** - * Adds a pipeline policy to apply on each request sent - * @param pipelinePolicy a pipeline policy - * @return the updated ContainerClientBuilder object - */ - public ContainerClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - this.policies.add(pipelinePolicy); - return this; - } - - /** - * Sets the logging level for service requests - * @param logLevel logging level - * @return the updated ContainerClientBuilder object - */ - public ContainerClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { - this.logLevel = logLevel; - return this; - } - - /** - * Sets the configuration object used to retrieve environment configuration values used to buildClient the client with - * when they are not set in the appendBlobClientBuilder, defaults to Configuration.NONE - * @param configuration configuration store - * @return the updated ContainerClientBuilder object - */ - public ContainerClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/ContainerListDetails.java b/storage/client/src/main/java/com/azure/storage/blob/ContainerListDetails.java deleted file mode 100644 index 473488f106e4c..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/ContainerListDetails.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.storage.blob.models.ListContainersIncludeType; - -/** - * This type allows users to specify additional information the service should return with each container when listing - * containers in an account (via a {@link ServiceURL} object). This type is immutable to ensure thread-safety of - * requests, so changing the details for a different listing operation requires construction of a new object. Null may - * be passed if none of the options are desirable. - */ -public final class ContainerListDetails { - - private boolean metadata; - - public ContainerListDetails() { - - } - - /** - * Whether metadata should be returned. - */ - public boolean metadata() { - return this.metadata; - } - - /** - * Whether metadata should be returned. - */ - public ContainerListDetails withMetadata(boolean metadata) { - this.metadata = metadata; - return this; - } - - /* - This is used internally to convert the details structure into the appropriate type to pass to the protocol layer. - It is intended to mirror the BlobListDetails.toList() method, but is slightly different since there is only one - possible value here currently. The customer should never have need for this. - */ - ListContainersIncludeType toIncludeType() { - if (this.metadata) { - return ListContainersIncludeType.METADATA; - } - return null; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/ContainerProperties.java b/storage/client/src/main/java/com/azure/storage/blob/ContainerProperties.java deleted file mode 100644 index 7e8d1f7487146..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/ContainerProperties.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.azure.storage.blob; - -import com.azure.storage.blob.models.ContainerGetPropertiesHeaders; -import com.azure.storage.blob.models.PublicAccessType; - -public class ContainerProperties { - - private PublicAccessType blobPublicAccess; - - private boolean hasImmutabilityPolicy; - - private boolean hasLegalHold; - - //todo decide datetime representation for last modified time - - - ContainerProperties(ContainerGetPropertiesHeaders generatedResponseHeaders) { - this.blobPublicAccess = generatedResponseHeaders.blobPublicAccess(); - this.hasImmutabilityPolicy = generatedResponseHeaders.hasImmutabilityPolicy(); - this.hasLegalHold = generatedResponseHeaders.hasLegalHold(); - } - - public PublicAccessType blobPublicAccess() { - return blobPublicAccess; - } - - public boolean hasImmutabilityPolicy() { - return hasImmutabilityPolicy; - } - - public boolean hasLegalHold() { - return hasLegalHold; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/ContainerRawClient.java b/storage/client/src/main/java/com/azure/storage/blob/ContainerRawClient.java deleted file mode 100644 index b817db16d7447..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/ContainerRawClient.java +++ /dev/null @@ -1,763 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.ContainersAcquireLeaseResponse; -import com.azure.storage.blob.models.ContainersBreakLeaseResponse; -import com.azure.storage.blob.models.ContainersChangeLeaseResponse; -import com.azure.storage.blob.models.ContainersCreateResponse; -import com.azure.storage.blob.models.ContainersDeleteResponse; -import com.azure.storage.blob.models.ContainersGetAccessPolicyResponse; -import com.azure.storage.blob.models.ContainersGetAccountInfoResponse; -import com.azure.storage.blob.models.ContainersGetPropertiesResponse; -import com.azure.storage.blob.models.ContainersListBlobFlatSegmentResponse; -import com.azure.storage.blob.models.ContainersListBlobHierarchySegmentResponse; -import com.azure.storage.blob.models.ContainersReleaseLeaseResponse; -import com.azure.storage.blob.models.ContainersRenewLeaseResponse; -import com.azure.storage.blob.models.ContainersSetAccessPolicyResponse; -import com.azure.storage.blob.models.ContainersSetMetadataResponse; -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.ModifiedAccessConditions; -import com.azure.storage.blob.models.PublicAccessType; -import com.azure.storage.blob.models.SignedIdentifier; -import reactor.core.publisher.Mono; - -import java.time.Duration; -import java.util.List; - -/** - * Represents a URL to a container. It may be obtained by direct construction or via the create method on a - * {@link StorageAsyncRawClient} object. This class does not hold any state about a particular blob but is instead a convenient way - * of sending off appropriate requests to the resource on the service. It may also be used to construct URLs to blobs. - * Please refer to the - * Azure Docs - * for more information on containers. - */ -final class ContainerRawClient { - - private ContainerAsyncRawClient containerAsyncRawClient; - - public static final String ROOT_CONTAINER_NAME = "$root"; - - public static final String STATIC_WEBSITE_CONTAINER_NAME = "$web"; - - public static final String LOG_CONTAINER_NAME = "$logs"; - - - /** - * Creates a {@code ContainerAsyncClient} object pointing to the account specified by the URL and using the provided - * pipeline to make HTTP requests. - */ - public ContainerRawClient(AzureBlobStorageImpl azureBlobStorage) { - this.containerAsyncRawClient = new ContainerAsyncRawClient(azureBlobStorage); - } - - /** - * Creates a new container within a storage account. If a container with the same name already exists, the operation - * fails. For more information, see the - * Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_basic "Sample code for ContainerAsyncClient.create")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersCreateResponse create() { - return this.create(null, null, null, null); - } - - /** - * Creates a new container within a storage account. If a container with the same name already exists, the operation - * fails. For more information, see the - * Azure Docs. - * - * @param metadata - * {@link Metadata} - * @param accessType - * Specifies how the data in this container is available to the public. See the x-ms-blob-public-access header - * in the Azure Docs for more information. Pass null for no public access. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_basic "Sample code for ContainerAsyncClient.create")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersCreateResponse create(Metadata metadata, PublicAccessType accessType, Duration timeout, Context context) { - Mono response = containerAsyncRawClient.create(metadata, accessType, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Marks the specified container for deletion. The container and any blobs contained within it are later - * deleted during garbage collection. For more information, see the - * Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_basic "Sample code for ContainerAsyncClient.delete")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersDeleteResponse delete() { - return this.delete(null, null, null); - } - - /** - * Marks the specified container for deletion. The container and any blobs contained within it are later - * deleted during garbage collection. For more information, see the - * Azure Docs. - * - * @param accessConditions - * {@link ContainerAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_basic "Sample code for ContainerAsyncClient.delete")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersDeleteResponse delete(ContainerAccessConditions accessConditions, Duration timeout, Context context) { - Mono response = containerAsyncRawClient.delete(accessConditions, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Returns the container's metadata and system properties. For more information, see the - * Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_basic "Sample code for ContainerAsyncClient.getProperties")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersGetPropertiesResponse getProperties() { - return this.getProperties(null, null, null); - } - - /** - * Returns the container's metadata and system properties. For more information, see the - * Azure Docs. - * - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_basic "Sample code for ContainerAsyncClient.getProperties")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersGetPropertiesResponse getProperties(LeaseAccessConditions leaseAccessConditions, - Duration timeout, Context context) { - Mono response = containerAsyncRawClient.getProperties(leaseAccessConditions, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Sets the container's metadata. For more information, see the - * Azure Docs. - * - * @param metadata - * {@link Metadata} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_basic "Sample code for ContainerAsyncClient.setMetadata")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersSetMetadataResponse setMetadata(Metadata metadata) { - return this.setMetadata(metadata, null, null, null); - } - - /** - * Sets the container's metadata. For more information, see the - * Azure Docs. - * - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link ContainerAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_basic "Sample code for ContainerAsyncClient.setMetadata")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersSetMetadataResponse setMetadata(Metadata metadata, - ContainerAccessConditions accessConditions, Duration timeout, Context context) { - Mono response = containerAsyncRawClient.setMetadata(metadata, accessConditions, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Returns the container's permissions. The permissions indicate whether container's blobs may be accessed publicly. - * For more information, see the - * Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_policy "Sample code for ContainerAsyncClient.getAccessPolicy")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersGetAccessPolicyResponse getAccessPolicy() { - return this.getAccessPolicy(null, null, null); - } - - /** - * Returns the container's permissions. The permissions indicate whether container's blobs may be accessed publicly. - * For more information, see the - * Azure Docs. - * - * @param leaseAccessConditions - * By setting lease access conditions, requests will fail if the provided lease does not match the active - * lease on the blob. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_policy "Sample code for ContainerAsyncClient.getAccessPolicy")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersGetAccessPolicyResponse getAccessPolicy(LeaseAccessConditions leaseAccessConditions, - Duration timeout, Context context) { - Mono response = containerAsyncRawClient.getAccessPolicy(leaseAccessConditions, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Sets the container's permissions. The permissions indicate whether blobs in a container may be accessed publicly. - * Note that, for each signed identifier, we will truncate the start and expiry times to the nearest second to - * ensure the time formatting is compatible with the service. For more information, see the - * Azure Docs. - * - * @param accessType - * Specifies how the data in this container is available to the public. See the x-ms-blob-public-access header - * in the Azure Docs for more information. Pass null for no public access. - * @param identifiers - * A list of {@link SignedIdentifier} objects that specify the permissions for the container. Please see - * here - * for more information. Passing null will clear all access policies. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_policy "Sample code for ContainerAsyncClient.setAccessPolicy")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersSetAccessPolicyResponse setAccessPolicy(PublicAccessType accessType, - List identifiers) { - return this.setAccessPolicy(accessType, identifiers, null, null, null); - } - - /** - * Sets the container's permissions. The permissions indicate whether blobs in a container may be accessed publicly. - * Note that, for each signed identifier, we will truncate the start and expiry times to the nearest second to - * ensure the time formatting is compatible with the service. For more information, see the - * Azure Docs. - * - * @param accessType - * Specifies how the data in this container is available to the public. See the x-ms-blob-public-access header - * in the Azure Docs for more information. Pass null for no public access. - * @param identifiers - * A list of {@link SignedIdentifier} objects that specify the permissions for the container. Please see - * here - * for more information. Passing null will clear all access policies. - * @param accessConditions - * {@link ContainerAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_policy "Sample code for ContainerAsyncClient.setAccessPolicy")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersSetAccessPolicyResponse setAccessPolicy(PublicAccessType accessType, - List identifiers, ContainerAccessConditions accessConditions, Duration timeout, Context context) { - Mono response = containerAsyncRawClient.setAccessPolicy(accessType, identifiers, accessConditions, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Acquires a lease on the container for delete operations. The lease duration must be between 15 to - * 60 seconds, or infinite (-1). For more information, see the - * Azure Docs. - * - * @apiNote - * ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.acquireLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/New-Storage-SDK-V10-Preview/src/test/java/com/microsoft/azure/storage/Samples.java) - * - * @param proposedId - * A {@code String} in any valid GUID format. - * @param duration - * The duration of the lease, in seconds, or negative one (-1) for a lease that never expires. - * A non-infinite lease can be between 15 and 60 seconds. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.acquireLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersAcquireLeaseResponse acquireLease(String proposedId, int duration) { - return this.acquireLease(proposedId, duration, null, null, null); - } - - /** - * Acquires a lease on the container for delete operations. The lease duration must be between 15 to - * 60 seconds, or infinite (-1). For more information, see the - * Azure Docs. - * - * @param proposedID - * A {@code String} in any valid GUID format. - * @param duration - * The duration of the lease, in seconds, or negative one (-1) for a lease that never expires. - * A non-infinite lease can be between 15 and 60 seconds. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.acquireLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersAcquireLeaseResponse acquireLease(String proposedID, int duration, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { - Mono response = containerAsyncRawClient.acquireLease(proposedID, duration, modifiedAccessConditions, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Renews the container's previously-acquired lease. For more information, see the - * Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the container. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.renewLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersRenewLeaseResponse renewLease(String leaseID) { - return this.renewLease(leaseID, null, null, null); - } - - /** - * Renews the container's previously-acquired lease. For more information, see the - * Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the container. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.renewLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersRenewLeaseResponse renewLease(String leaseID, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { - Mono response = containerAsyncRawClient.renewLease(leaseID, modifiedAccessConditions, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Releases the container's previously-acquired lease. For more information, see the - * Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the container. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.releaseLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersReleaseLeaseResponse releaseLease(String leaseID) { - return this.releaseLease(leaseID, null, null, null); - } - - /** - * Releases the container's previously-acquired lease. For more information, see the - * Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the container. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.releaseLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersReleaseLeaseResponse releaseLease(String leaseID, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { - Mono response = containerAsyncRawClient.releaseLease(leaseID, modifiedAccessConditions, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Breaks the container's previously-acquired lease. For more information, see the - * Azure Docs. - * - * @apiNote - * ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.breakLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/New-Storage-SDK-V10-Preview/src/test/java/com/microsoft/azure/storage/Samples.java) - * - * @return Emits the successful response. - */ - public ContainersBreakLeaseResponse breakLease() { - return this.breakLease(null, null, null, null); - } - - /** - * Breaks the container's previously-acquired lease. For more information, see the - * Azure Docs. - * - * @param breakPeriodInSeconds - * An optional {@code Integer} representing the proposed duration of seconds that the lease should continue - * before it is broken, between 0 and 60 seconds. This break period is only used if it is shorter than the time - * remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be - * available before the break period has expired, but the lease may be held for longer than the break period. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.breakLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersBreakLeaseResponse breakLease(Integer breakPeriodInSeconds, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { - Mono response = containerAsyncRawClient.breakLease(breakPeriodInSeconds, modifiedAccessConditions, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Changes the container's leaseAccessConditions. For more information, see the - * Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the container. - * @param proposedID - * A {@code String} in any valid GUID format. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.changeLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersChangeLeaseResponse changeLease(String leaseID, String proposedID) { - return this.changeLease(leaseID, proposedID, null, null, null); - } - - /** - * Changes the container's leaseAccessConditions. For more information, see the - * Azure Docs. - * - * @param leaseID - * The leaseId of the active lease on the container. - * @param proposedID - * A {@code String} in any valid GUID format. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=container_lease "Sample code for ContainerAsyncClient.changeLease")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersChangeLeaseResponse changeLease(String leaseID, String proposedID, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { - Mono response = containerAsyncRawClient.changeLease(leaseID, proposedID, modifiedAccessConditions, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Returns a single segment of blobs starting from the specified Marker. Use an empty - * marker to start enumeration from the beginning. Blob names are returned in lexicographic order. - * After getting a segment, process it, and then call ListBlobs again (passing the the previously-returned - * Marker) to get the next segment. For more information, see the - * Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListBlobsFlatSegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param options - * {@link ListBlobsOptions} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_flat "Sample code for ContainerAsyncClient.listBlobsFlatSegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_flat_helper "helper code for ContainerAsyncClient.listBlobsFlatSegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersListBlobFlatSegmentResponse listBlobsFlatSegment(String marker, ListBlobsOptions options) { - return this.listBlobsFlatSegment(marker, options, null, null); - } - - /** - * Returns a single segment of blobs starting from the specified Marker. Use an empty - * marker to start enumeration from the beginning. Blob names are returned in lexicographic order. - * After getting a segment, process it, and then call ListBlobs again (passing the the previously-returned - * Marker) to get the next segment. For more information, see the - * Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListBlobsFlatSegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param options - * {@link ListBlobsOptions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_flat "Sample code for ContainerAsyncClient.listBlobsFlatSegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_flat_helper "helper code for ContainerAsyncClient.listBlobsFlatSegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersListBlobFlatSegmentResponse listBlobsFlatSegment(String marker, ListBlobsOptions options, - Duration timeout, Context context) { - Mono response = containerAsyncRawClient.listBlobsFlatSegment(marker, options, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Returns a single segment of blobs and blob prefixes starting from the specified Marker. Use an empty - * marker to start enumeration from the beginning. Blob names are returned in lexicographic order. - * After getting a segment, process it, and then call ListBlobs again (passing the the previously-returned - * Marker) to get the next segment. For more information, see the - * Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListBlobsHierarchySegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param delimiter - * The operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs - * whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may - * be a single character or a string. - * @param options - * {@link ListBlobsOptions} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy "Sample code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy_helper "helper code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersListBlobHierarchySegmentResponse listBlobsHierarchySegment(String marker, String delimiter, - ListBlobsOptions options) { - return this.listBlobsHierarchySegment(marker, delimiter, options, null, null); - } - - /** - * Returns a single segment of blobs and blob prefixes starting from the specified Marker. Use an empty - * marker to start enumeration from the beginning. Blob names are returned in lexicographic order. - * After getting a segment, process it, and then call ListBlobs again (passing the the previously-returned - * Marker) to get the next segment. For more information, see the - * Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListBlobsHierarchySegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param delimiter - * The operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs - * whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may - * be a single character or a string. - * @param options - * {@link ListBlobsOptions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy "Sample code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=list_blobs_hierarchy_helper "helper code for ContainerAsyncClient.listBlobsHierarchySegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersListBlobHierarchySegmentResponse listBlobsHierarchySegment(String marker, String delimiter, - ListBlobsOptions options, Duration timeout, Context context) { - Mono response = containerAsyncRawClient.listBlobsHierarchySegment(marker, delimiter, options, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the - * Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=account_info "Sample code for ContainerAsyncClient.getAccountInfo")] \n - * For more samples, please see the [Samples file] (https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersGetAccountInfoResponse getAccountInfo() { - return this.getAccountInfo(null, null); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the - * Azure Docs. - * - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=account_info "Sample code for ContainerAsyncClient.getAccountInfo")] \n - * For more samples, please see the [Samples file] (https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ContainersGetAccountInfoResponse getAccountInfo(Duration timeout, Context context) { - Mono response = containerAsyncRawClient.getAccountInfo(context); - return timeout == null - ? response.block() - : response.block(timeout); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/ContainerSASPermission.java b/storage/client/src/main/java/com/azure/storage/blob/ContainerSASPermission.java deleted file mode 100644 index 413f147d4e873..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/ContainerSASPermission.java +++ /dev/null @@ -1,204 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - - -import java.util.Locale; - -/** - * This is a helper class to construct a string representing the permissions granted by a ServiceSAS to a container. - * Setting a value to true means that any SAS which uses these permissions will grant permissions for that operation. - * Once all the values are set, this should be serialized with toString and set as the permissions field on a - * {@link ServiceSASSignatureValues} object. It is possible to construct the permissions string without this class, but - * the order of the permissions is particular and this class guarantees correctness. - */ -final class ContainerSASPermission { - private boolean read; - - private boolean add; - - private boolean create; - - private boolean write; - - private boolean delete; - - private boolean list; - - /** - * Initializes an {@code ContainerSASPermssion} object with all fields set to false. - */ - public ContainerSASPermission() { - } - - /** - * Creates an {@code ContainerSASPermission} from the specified permissions string. This method will throw an - * {@code IllegalArgumentException} if it encounters a character that does not correspond to a valid permission. - * - * @param permString - * A {@code String} which represents the {@code ContainerSASPermission}. - * - * @return A {@code ContainerSASPermission} generated from the given {@code String}. - */ - public static ContainerSASPermission parse(String permString) { - ContainerSASPermission permissions = new ContainerSASPermission(); - - for (int i = 0; i < permString.length(); i++) { - char c = permString.charAt(i); - switch (c) { - case 'r': - permissions.read = true; - break; - case 'a': - permissions.add = true; - break; - case 'c': - permissions.create = true; - break; - case 'w': - permissions.write = true; - break; - case 'd': - permissions.delete = true; - break; - case 'l': - permissions.list = true; - break; - default: - throw new IllegalArgumentException( - String.format(Locale.ROOT, SR.ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE, "Permissions", permString, c)); - } - } - return permissions; - } - - /** - * Specifies Read access granted. - */ - public boolean read() { - return read; - } - - /** - * Specifies Read access granted. - */ - public ContainerSASPermission withRead(boolean read) { - this.read = read; - return this; - } - - /** - * Specifies Add access granted. - */ - public boolean add() { - return add; - } - - /** - * Specifies Add access granted. - */ - public ContainerSASPermission withAdd(boolean add) { - this.add = add; - return this; - } - - /** - * Specifies Create access granted. - */ - public boolean create() { - return create; - } - - /** - * Specifies Create access granted. - */ - public ContainerSASPermission withCreate(boolean create) { - this.create = create; - return this; - } - - /** - * Specifies Write access granted. - */ - public boolean write() { - return write; - } - - /** - * Specifies Write access granted. - */ - public ContainerSASPermission withWrite(boolean write) { - this.write = write; - return this; - } - - /** - * Specifies Delete access granted. - */ - public boolean delete() { - return delete; - } - - /** - * Specifies Delete access granted. - */ - public ContainerSASPermission withDelete(boolean delete) { - this.delete = delete; - return this; - } - - /** - * Specifies List access granted. - */ - public boolean list() { - return list; - } - - /** - * Specifies List access granted. - */ - public ContainerSASPermission withList(boolean list) { - this.list = list; - return this; - } - - /** - * Converts the given permissions to a {@code String}. Using this method will guarantee the permissions are in an - * order accepted by the service. - * - * @return A {@code String} which represents the {@code ContainerSASPermission}. - */ - @Override - public String toString() { - // The order of the characters should be as specified here to ensure correctness: - // https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas - final StringBuilder builder = new StringBuilder(); - - if (this.read) { - builder.append('r'); - } - - if (this.add) { - builder.append('a'); - } - - if (this.create) { - builder.append('c'); - } - - if (this.write) { - builder.append('w'); - } - - if (this.delete) { - builder.append('d'); - } - - if (this.list) { - builder.append('l'); - } - - return builder.toString(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java b/storage/client/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java deleted file mode 100644 index 0addf86a77346..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/DownloadAsyncResponse.java +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.rest.ResponseBase; -import com.azure.storage.blob.models.BlobDownloadHeaders; -import io.netty.buffer.ByteBuf; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.Map; -import java.util.function.Function; - -/** - * {@code DownloadAsyncResponse} wraps the protocol-layer response from {@link BlobAsyncClient#download(BlobRange, - * BlobAccessConditions, boolean, com.azure.core.util.Context)} to automatically retry failed reads from the body as - * appropriate. If the download is interrupted, the {@code DownloadAsyncResponse} will make a request to resume the download - * from where it left off, allowing the user to consume the data as one continuous stream, for any interruptions are - * hidden. The retry behavior is defined by the options passed to the {@link #body(ReliableDownloadOptions)}. The - * download will also lock on the blob's etag to ensure consistency. - *

- * Note that the retries performed as a part of this reader are composed with those of any retries in an {@link - * com.azure.core.http.HttpPipeline} used in conjunction with this reader. That is, if this object issues a request to resume a download, - * an underlying pipeline may issue several retries as a part of that request. Furthermore, this reader only retries on - * network errors; timeouts and unexpected status codes are not retried. Therefore, the behavior of this reader is - * entirely independent of and in no way coupled to an {@link com.azure.core.http.HttpPipeline}'s retry mechanism. - */ -public final class DownloadAsyncResponse { - private final HTTPGetterInfo info; - - private final ResponseBase> rawResponse; - - private final Function> getter; - - - // The constructor is package-private because customers should not be creating their own responses. - // TODO resolve comment vs code mismatch - public DownloadAsyncResponse(ResponseBase> response, - HTTPGetterInfo info, Function> getter) { - Utility.assertNotNull("getter", getter); - Utility.assertNotNull("info", info); - Utility.assertNotNull("info.eTag", info.eTag()); - this.rawResponse = response; - this.info = info; - this.getter = getter; - } - - /** - * Returns the response body which has been modified to enable reliably reading data if desired (if - * {@code options.maxRetryRequests > 0}. If retries are enabled, if a connection fails while reading, the stream - * will make additional requests to reestablish a connection and continue reading. - * - * @param options - * {@link ReliableDownloadOptions} - * - * @return A {@code Flux} which emits the data as {@code ByteBuffer}s. - */ - public Flux body(ReliableDownloadOptions options) { - ReliableDownloadOptions optionsReal = options == null ? new ReliableDownloadOptions() : options; - if (optionsReal.maxRetryRequests() == 0) { - return this.rawResponse.value(); - } - - /* - We pass -1 for currentRetryCount because we want tryContinueFlux to receive a value of 0 for number of - retries as we have not actually retried yet, only made the initial try. Because applyReliableDownload() will - add 1 before calling into tryContinueFlux, we set the initial value to -1. - */ - return this.applyReliableDownload(this.rawResponse.value(), -1, optionsReal); - } - - private Flux tryContinueFlux(Throwable t, int retryCount, ReliableDownloadOptions options) { - // If all the errors are exhausted, return this error to the user. - if (retryCount > options.maxRetryRequests() || !(t instanceof IOException)) { - return Flux.error(t); - } else { - /* - We wrap this in a try catch because we don't know the behavior of the getter. Most errors would probably - come from an unsuccessful request, which would be propagated through the onError methods. However, it is - possible the method call that returns a Single is what throws (like how our apis throw some exceptions at - call time rather than at subscription time. - */ - try { - // Get a new response and try reading from it. - return getter.apply(this.info) - .flatMapMany(response -> - /* - Do not compound the number of retries by passing in another set of downloadOptions; just get - the raw body. - */ - this.applyReliableDownload(this.rawResponse.value(), retryCount, options)); - } catch (Exception e) { - // If the getter fails, return the getter failure to the user. - return Flux.error(e); - } - } - } - - private Flux applyReliableDownload(Flux data, - int currentRetryCount, ReliableDownloadOptions options) { - return data - .doOnNext(buffer -> { - /* - Update how much data we have received in case we need to retry and propagate to the user the data we - have received. - */ - this.info.withOffset(this.info.offset() + buffer.readableBytes()); // was `remaining()` in Rx world - if (this.info.count() != null) { - this.info.withCount(this.info.count() - buffer.readableBytes()); // was `remaining()` in Rx world - } - }) - .onErrorResume(t2 -> { - // Increment the retry count and try again with the new exception. - return tryContinueFlux(t2, currentRetryCount + 1, options); - }); - } - - public int statusCode() { - return this.rawResponse.statusCode(); - } - - public BlobDownloadHeaders headers() { - return this.rawResponse.deserializedHeaders(); - } - - public Map rawHeaders() { - return this.rawResponse.headers().toMap(); - } - - public ResponseBase> rawResponse() { - return this.rawResponse; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/DownloadResponse.java b/storage/client/src/main/java/com/azure/storage/blob/DownloadResponse.java deleted file mode 100644 index c6667d3e16dd1..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/DownloadResponse.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.azure.storage.blob; - -import io.netty.buffer.ByteBuf; - -import java.io.IOException; -import java.io.OutputStream; - -public class DownloadResponse { - private final DownloadAsyncResponse asyncResponse; - - DownloadResponse(DownloadAsyncResponse asyncResponse) { - this.asyncResponse = asyncResponse; - } - - public void body(OutputStream outputStream, ReliableDownloadOptions options) throws IOException { - for (ByteBuf buffer : this.asyncResponse.body(options).toIterable()) { - buffer.readBytes(outputStream, buffer.readableBytes()); - buffer.release(); - } - } - - //TODO determine signature(s) to use - /*public InputStream body(ReliableDownloadOptions options) { - return new InputStream() { - - DownloadAsyncResponse response = asyncResponse; - @Override - public int read() throws IOException { - return 0; - } - }; - }*/ -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/HTTPGetterInfo.java b/storage/client/src/main/java/com/azure/storage/blob/HTTPGetterInfo.java deleted file mode 100644 index cb1fdf86ef2c6..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/HTTPGetterInfo.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -/** - * HTTPGetterInfo is a passed to the getter function of a reliable download to specify parameters needed for the GET - * request. - */ -final class HTTPGetterInfo { - private long offset = 0; - - private Long count = null; - - private String eTag = null; - - /** - * The start offset that should be used when creating the HTTP GET request's Range header. Defaults to 0. - */ - public long offset() { - return offset; - } - - /** - * The start offset that should be used when creating the HTTP GET request's Range header. Defaults to 0. - */ - public HTTPGetterInfo withOffset(long offset) { - this.offset = offset; - return this; - } - - /** - * The count of bytes that should be used to calculate the end offset when creating the HTTP GET request's Range - * header. {@code} null is the default and indicates that the entire rest of the blob should be retrieved. - */ - public Long count() { - return count; - } - - /** - * The count of bytes that should be used to calculate the end offset when creating the HTTP GET request's Range - * header. {@code} null is the default and indicates that the entire rest of the blob should be retrieved. - */ - public HTTPGetterInfo withCount(Long count) { - if (count != null) { - Utility.assertInBounds("count", count, 0, Long.MAX_VALUE); - } - this.count = count; - return this; - } - - /** - * The resource's etag that should be used when creating the HTTP GET request's If-Match header. Note that the - * Etag is returned with any operation that modifies the resource and by a call to {@link - * BlobURL#getProperties(BlobAccessConditions, com.microsoft.rest.v2.Context)}. Defaults to null. - */ - public String eTag() { - return eTag; - } - - /** - * The resource's etag that should be used when creating the HTTP GET request's If-Match header. Note that the - * Etag is returned with any operation that modifies the resource and by a call to {@link - * BlobURL#getProperties(BlobAccessConditions, com.microsoft.rest.v2.Context)}. Defaults to null. - */ - public HTTPGetterInfo withETag(String eTag) { - this.eTag = eTag; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/ICredentials.java b/storage/client/src/main/java/com/azure/storage/blob/ICredentials.java deleted file mode 100644 index c47470fa7d93e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/ICredentials.java +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.policy.HttpPipelinePolicy; - -/** - * Credentials represent any credential type - * it is used to create a credential policy Factory. - */ -public interface ICredentials extends HttpPipelinePolicy { - -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/IPRange.java b/storage/client/src/main/java/com/azure/storage/blob/IPRange.java deleted file mode 100644 index 02a7c6ca19336..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/IPRange.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -/** - * This type specifies a continuous range of IP addresses. It is used to limit permissions on SAS tokens. Null may be - * set if it is not desired to confine the sas permissions to an IP range. Please refer to - * {@link AccountSASSignatureValues} or {@link ServiceSASSignatureValues} for more information. - */ -final class IPRange { - - private String ipMin; - - private String ipMax; - - public IPRange() { - } - - /** - * Creates a {@code IPRange} from the specified string. - * - * @param rangeStr - * The {@code String} representation of the {@code IPRange}. - * - * @return The {@code IPRange} generated from the {@code String}. - */ - public static IPRange parse(String rangeStr) { - String[] addrs = rangeStr.split("-"); - IPRange range = new IPRange(); - range.ipMin = addrs[0]; - if (addrs.length > 1) { - range.ipMax = addrs[1]; - } - return range; - } - - /** - * The minimum IP address of the range. - */ - public String ipMin() { - return ipMin; - } - - /** - * The minimum IP address of the range. - */ - public IPRange withIpMin(String ipMin) { - this.ipMin = ipMin; - return this; - } - - /** - * The maximum IP address of the range. - */ - public String ipMax() { - return ipMax; - } - - /** - * The maximum IP address of the range. - */ - public IPRange withIpMax(String ipMax) { - this.ipMax = ipMax; - return this; - } - - /** - * Output the single IP address or range of IP addresses for. - * - * @return The single IP address or range of IP addresses formatted as a {@code String}. - */ - @Override - public String toString() { - if (this.ipMin == null) { - return ""; - } - this.ipMax = this.ipMax == null ? this.ipMin : this.ipMax; - StringBuilder str = new StringBuilder(this.ipMin); - if (!this.ipMin.equals(this.ipMax)) { - str.append('-'); - str.append(this.ipMax); - } - - return str.toString(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/IProgressReceiver.java b/storage/client/src/main/java/com/azure/storage/blob/IProgressReceiver.java deleted file mode 100644 index ab336e1862892..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/IProgressReceiver.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -/** - * An {@code IProgressReceiver} is an object that can be used to report progress on network transfers. When specified on - * transfer operations, the {@code reportProgress} method will be called periodically with the total number of bytes - * transferred. The user may configure this method to report progress in whatever format desired. It is recommended - * that this type be used in conjunction with - * {@link ProgressReporter#addProgressReporting(reactor.core.publisher.Flux, IProgressReceiver)}. - */ -interface IProgressReceiver { - - /** - * The callback function invoked as progress is reported. - * - * @param bytesTransferred - * The total number of bytes transferred during this transaction. - */ - void reportProgress(long bytesTransferred); -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/ListBlobsOptions.java b/storage/client/src/main/java/com/azure/storage/blob/ListBlobsOptions.java deleted file mode 100644 index f493c8de5f75f..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/ListBlobsOptions.java +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -/** - * Defines options available to configure the behavior of a call to listBlobsFlatSegment on a {@link ContainerURL} - * object. See the constructor for details on each of the options. - */ -public final class ListBlobsOptions { - - private BlobListDetails details; - - private String prefix; - - private Integer maxResults; - - public ListBlobsOptions() { - this.details = new BlobListDetails(); - } - - /** - * {@link BlobListDetails} - */ - public BlobListDetails details() { - return details; - } - - /** - * {@link BlobListDetails} - */ - public ListBlobsOptions withDetails(BlobListDetails details) { - this.details = details; - return this; - } - - /** - * Filters the results to return only blobs whose names begin with the specified prefix. May be null to return - * all blobs. - */ - public String prefix() { - return prefix; - } - - /** - * Filters the results to return only blobs whose names begin with the specified prefix. May be null to return - * all blobs. - */ - public ListBlobsOptions withPrefix(String prefix) { - this.prefix = prefix; - return this; - } - - /** - * Specifies the maximum number of blobs to return, including all BlobPrefix elements. If the request does not - * specify maxResults or specifies a value greater than 5,000, the server will return up to 5,000 items. - */ - public Integer maxResults() { - return maxResults; - } - - /** - * Specifies the maximum number of blobs to return, including all BlobPrefix elements. If the request does not - * specify maxResults or specifies a value greater than 5,000, the server will return up to 5,000 items. - */ - public ListBlobsOptions withMaxResults(Integer maxResults) { - if (maxResults != null && maxResults <= 0) { - throw new IllegalArgumentException("MaxResults must be greater than 0."); - } - this.maxResults = maxResults; - return this; - } - - -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/ListContainersOptions.java b/storage/client/src/main/java/com/azure/storage/blob/ListContainersOptions.java deleted file mode 100644 index 7cd6d773fcf19..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/ListContainersOptions.java +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -/** - * Defines options available to configure the behavior of a call to listContainersSegment on a {@link ServiceURL} - * object. See the constructor for details on each of the options. Null may be passed in place of an object of this - * type if no options are desirable. - */ -public final class ListContainersOptions { - - private ContainerListDetails details; - - private String prefix; - - private Integer maxResults; - - public ListContainersOptions() { - this.details = new ContainerListDetails(); - } - - /** - * {@link ContainerListDetails} - */ - public ContainerListDetails details() { - return details; - } - - /** - * {@link ContainerListDetails} - */ - public ListContainersOptions withDetails(ContainerListDetails details) { - this.details = details; - return this; - } - - /** - * Filters the results to return only blobs whose names begin with the specified prefix. * - */ - public String prefix() { - return prefix; - } - - /** - * Filters the results to return only blobs whose names begin with the specified prefix. * - */ - public ListContainersOptions withPrefix(String prefix) { - this.prefix = prefix; - return this; - } - - /** - * Specifies the maximum number of blobs to return, including all BlobPrefix elements. If the request does not - * specify maxResults or specifies a value greater than 5,000, the server will return up to 5,000 items. - */ - public Integer maxResults() { - return maxResults; - } - - /** - * Specifies the maximum number of blobs to return, including all BlobPrefix elements. If the request does not - * specify maxResults or specifies a value greater than 5,000, the server will return up to 5,000 items. - */ - public ListContainersOptions withMaxResults(Integer maxResults) { - if (maxResults != null && maxResults <= 0) { - throw new IllegalArgumentException("MaxResults must be greater than 0."); - } - this.maxResults = maxResults; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/LoggingFactory.java b/storage/client/src/main/java/com/azure/storage/blob/LoggingFactory.java deleted file mode 100644 index 7d6732eccc6e3..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/LoggingFactory.java +++ /dev/null @@ -1,357 +0,0 @@ -//// Copyright (c) Microsoft Corporation. All rights reserved. -//// Licensed under the MIT License. -// -//package com.azure.storage.blob; -// -//import com.microsoft.rest.v2.http.HttpPipeline; -//import com.microsoft.rest.v2.http.HttpPipelineLogLevel; -//import com.microsoft.rest.v2.http.HttpRequest; -//import com.microsoft.rest.v2.http.HttpResponse; -//import com.microsoft.rest.v2.policy.RequestPolicy; -//import com.microsoft.rest.v2.policy.RequestPolicyFactory; -//import com.microsoft.rest.v2.policy.RequestPolicyOptions; -//import io.reactivex.Single; -//import org.slf4j.LoggerFactory; -// -//import java.io.File; -//import java.net.HttpURLConnection; -//import java.net.MalformedURLException; -//import java.net.URL; -//import java.net.UnknownHostException; -//import java.util.HashMap; -//import java.util.Locale; -//import java.util.Map; -//import java.util.logging.FileHandler; -//import java.util.logging.Level; -//import java.util.logging.Logger; -// -///** -// * This is a factory which creates policies in an {@link HttpPipeline} for logging requests and responses. In most -// * cases, it is sufficient to configure an object of the {@link LoggingOptions} type and set those as a field on a -// * {@link PipelineOptions} structure to configure a default pipeline. The factory and policy must only be used directly -// * when creating a custom pipeline. -// */ -//public final class LoggingFactory implements RequestPolicyFactory { -// -// private static final Logger FORCE_LOGGER = Logger.getLogger(LoggingFactory.class.getName()); -// private static final org.slf4j.Logger SLF4J_LOGGER = LoggerFactory.getLogger(LoggingFactory.class.getName()); -// private static final Map JAVA_LOG_LEVEL_MAP = new HashMap<>(); -// private static boolean defaultLoggerLoaded; -// -// static { -// try { -// FORCE_LOGGER.setLevel(Level.WARNING); -// -// // Create the logs directory if it doesn't exist. -// File logDir = new File(System.getProperty("java.io.tmpdir"), "AzureStorageJavaSDKLogs"); -// if (!logDir.exists()) { -// if (!logDir.mkdir()) { -// throw new Exception("Could not create logs directory"); -// } -// } -// -// /* -// "/" the local pathname separator -// "%t" the system temporary directory -// "%h" the value of the "user.home" system property -// "%g" the generation number to distinguish rotated logs -// "%u" a unique number to resolve conflicts -// "%%" translates to a single percent sign "%" -// -// 10MB files, 5 files -// -// true- append mode -// */ -// FileHandler handler = new FileHandler("%t/AzureStorageJavaSDKLogs/%u%g", 10 * Constants.MB, 5, false); -// handler.setLevel(Level.WARNING); -// FORCE_LOGGER.addHandler(handler); -// -// JAVA_LOG_LEVEL_MAP.put(HttpPipelineLogLevel.ERROR, Level.SEVERE); -// JAVA_LOG_LEVEL_MAP.put(HttpPipelineLogLevel.WARNING, Level.WARNING); -// JAVA_LOG_LEVEL_MAP.put(HttpPipelineLogLevel.INFO, Level.INFO); -// defaultLoggerLoaded = true; -// -// /* -// If we can't setup default logging, there's nothing we can do. We shouldn't interfere with the rest of logging. -// */ -// } catch (Exception e) { -// defaultLoggerLoaded = false; -// System.err.println("Azure Storage default logging could not be configured due to the following exception: " -// + e); -// } -// } -// -// private final LoggingOptions loggingOptions; -// -// /** -// * Creates a factory which can create LoggingPolicy objects to insert in the pipeline. This will allow for logging -// * requests and responses. -// * -// * @param loggingOptions -// * The configurations for this factory. Null will indicate use of the default options. -// */ -// public LoggingFactory(LoggingOptions loggingOptions) { -// this.loggingOptions = loggingOptions == null ? new LoggingOptions() : loggingOptions; -// } -// -// @Override -// public RequestPolicy create(RequestPolicy next, RequestPolicyOptions options) { -// return new LoggingPolicy(this, next, options); -// } -// -// private static final class LoggingPolicy implements RequestPolicy { -// -// private final LoggingFactory factory; -// -// private final RequestPolicy nextPolicy; -// -// private final RequestPolicyOptions options; -// -// // The following fields are not final because they are updated by the policy. -// private int tryCount; -// -// private long operationStartTime; -// -// private long requestStartTime; -// -// /** -// * Creates a policy which configures the logging behavior within the -// * {@link com.microsoft.rest.v2.http.HttpPipeline}. -// * -// * @param nextPolicy -// * {@link RequestPolicy} -// * @param options -// * {@link RequestPolicyOptions} -// * @param factory -// * {@link LoggingFactory} -// */ -// private LoggingPolicy(LoggingFactory factory, RequestPolicy nextPolicy, RequestPolicyOptions options) { -// this.factory = factory; -// this.nextPolicy = nextPolicy; -// this.options = options; -// } -// -// /** -// * Logs as appropriate. -// * -// * @param request -// * The request to log. -// * -// * @return A {@link Single} representing the {@link HttpResponse} that will arrive asynchronously. -// */ -// @Override -// public Single sendAsync(final HttpRequest request) { -// this.tryCount++; -// this.requestStartTime = System.currentTimeMillis(); -// if (this.tryCount == 1) { -// this.operationStartTime = requestStartTime; -// } -// -// if (this.shouldLog(HttpPipelineLogLevel.INFO)) { -// String logMessage = String.format("'%s'==> OUTGOING REQUEST (Try number='%d')%n", -// sanitizeURL(request.url()), this.tryCount); -// this.log(HttpPipelineLogLevel.INFO, logMessage); -// } -// -// return nextPolicy.sendAsync(request) -// .doOnError(throwable -> { -// if (this.shouldLog(HttpPipelineLogLevel.ERROR)) { -// String logMessage = String.format( -// "Unexpected failure attempting to make request.%nError message:'%s'%n", -// throwable.getMessage()); -// this.log(HttpPipelineLogLevel.ERROR, logMessage); -// } -// }) -// .doOnSuccess(response -> { -// long requestEndTime = System.currentTimeMillis(); -// long requestCompletionTime = requestEndTime - requestStartTime; -// long operationDuration = requestEndTime - operationStartTime; -// HttpPipelineLogLevel currentLevel = HttpPipelineLogLevel.INFO; -// -// String logMessage = Constants.EMPTY_STRING; -// if (this.shouldLog(HttpPipelineLogLevel.INFO)) { -// // Assume success and default to informational logging. -// logMessage = "Successfully Received Response" + System.lineSeparator(); -// } -// -// // If the response took too long, we'll upgrade to warning. -// if (requestCompletionTime -// >= factory.loggingOptions.minDurationToLogSlowRequestsInMs()) { -// // Log a warning if the try duration exceeded the specified threshold. -// if (this.shouldLog(HttpPipelineLogLevel.WARNING)) { -// currentLevel = HttpPipelineLogLevel.WARNING; -// logMessage = String.format(Locale.ROOT, -// "SLOW OPERATION. Duration > %d ms.%n", -// factory.loggingOptions.minDurationToLogSlowRequestsInMs()); -// } -// } -// -// if (((response.statusCode() >= 400 && response.statusCode() <= 499) -// && (response.statusCode() != HttpURLConnection.HTTP_NOT_FOUND -// && response.statusCode() != HttpURLConnection.HTTP_CONFLICT -// && response.statusCode() != HttpURLConnection.HTTP_PRECON_FAILED -// && response.statusCode() != 416)) -// /* 416 is missing from the Enum but it is Range Not Satisfiable */ -// || (response.statusCode() >= 500 && response.statusCode() <= 509)) { -// String errorString = String.format(Locale.ROOT, -// "REQUEST ERROR%nHTTP request failed with status code:'%d'%n", -// response.statusCode()); -// if (currentLevel == HttpPipelineLogLevel.WARNING) { -// logMessage += errorString; -// } else { -// logMessage = errorString; -// } -// -// currentLevel = HttpPipelineLogLevel.ERROR; -// } -// -// /* -// We don't want to format the log message unless we have to. Format once we've determined that -// either the customer wants this log level or we need to force log it. -// */ -// if (this.shouldLog(currentLevel)) { -// String additionalMessageInfo = buildAdditionalMessageInfo(request); -// String messageInfo = String.format(Locale.ROOT, -// "Request try:'%d', request duration:'%d' ms, operation duration:'%d' ms%n%s", -// tryCount, requestCompletionTime, operationDuration, additionalMessageInfo); -// this.log(currentLevel, logMessage + messageInfo); -// } -// }); -// } -// -// private String buildAdditionalMessageInfo(final HttpRequest httpRequest) { -// HttpRequest sanitizedRequest = buildSanitizedRequest(httpRequest); -// StringBuilder stringBuilder = new StringBuilder(); -// String format = "%s: %s" + System.lineSeparator(); -// stringBuilder.append(String.format(format, sanitizedRequest.httpMethod().toString(), -// sanitizedRequest.url().toString())); -// sanitizedRequest.headers().forEach((header) -> stringBuilder.append(String.format(format, header.name(), -// header.value()))); -// return stringBuilder.toString(); -// } -// -// private HttpRequest buildSanitizedRequest(final HttpRequest initialRequest) { -// // Build new URL and redact SAS signature, if present -// URL url = sanitizeURL(initialRequest.url()); -// -// // Build resultRequest -// HttpRequest resultRequest = new HttpRequest( -// initialRequest.callerMethod(), -// initialRequest.httpMethod(), -// url, -// initialRequest.headers(), -// initialRequest.body(), -// initialRequest.responseDecoder()); -// -// // Redact Authorization header, if present -// if (resultRequest.headers().value(Constants.HeaderConstants.AUTHORIZATION) != null) { -// resultRequest.headers().set(Constants.HeaderConstants.AUTHORIZATION, Constants.REDACTED); -// } -// -// // Redact Copy Source header SAS signature, if present -// if (resultRequest.headers().value(Constants.HeaderConstants.COPY_SOURCE) != null) { -// try { -// URL copySourceUrl = sanitizeURL(new URL(resultRequest.headers() -// .value(Constants.HeaderConstants.COPY_SOURCE))); -// resultRequest.headers().set(Constants.HeaderConstants.COPY_SOURCE, copySourceUrl.toString()); -// } catch (MalformedURLException e) { -// throw new RuntimeException(e); -// } -// } -// -// return resultRequest; -// } -// -// private URL sanitizeURL(URL initialURL) { -// URL resultURL = initialURL; -// try { -// BlobURLParts urlParts = URLParser.parse(initialURL); -// if (urlParts.sasQueryParameters() == null || urlParts.sasQueryParameters().signature() == null) { -// return resultURL; -// } -// urlParts.withSasQueryParameters(new SASQueryParameters( -// urlParts.sasQueryParameters().version(), -// urlParts.sasQueryParameters().services(), -// urlParts.sasQueryParameters().resourceTypes(), -// urlParts.sasQueryParameters().protocol(), -// urlParts.sasQueryParameters().startTime(), -// urlParts.sasQueryParameters().expiryTime(), -// urlParts.sasQueryParameters().ipRange(), -// urlParts.sasQueryParameters().identifier(), -// urlParts.sasQueryParameters().resource(), -// urlParts.sasQueryParameters().permissions(), -// Constants.REDACTED, -// urlParts.sasQueryParameters().cacheControl(), -// urlParts.sasQueryParameters().contentDisposition(), -// urlParts.sasQueryParameters().contentEncoding(), -// urlParts.sasQueryParameters().contentLanguage(), -// urlParts.sasQueryParameters().contentType(), -// urlParts.sasQueryParameters().userDelegationKey() -// )); -// resultURL = urlParts.toURL(); -// -// /* -// We are only making valid changes to what has already been validated as a URL (since we got it from a -// URL object), so there should be no need for either us or the caller to check this error. -// */ -// } catch (UnknownHostException | MalformedURLException e) { -// throw new RuntimeException(e); -// } -// return resultURL; -// } -// -// /* -// We need to support the HttpPipelineLogger as it already exists. We also want to allow users to hook up SLF4J. -// Finally, we need to do our own default logging. -// */ -// private void log(HttpPipelineLogLevel level, String message) { -// /* -// We need to explicitly check before we send it to the HttpPipelineLogger as its log function may only -// expect to receive messages for which shouldLog() returns true. -// */ -// if (this.options.shouldLog(level)) { -// this.options.log(level, message); -// } -// -// /* -// The Java logger and slf4j logger should do the correct thing given any log level. FORCE_LOGGER is -// configured to only log warnings and errors. -// */ -// if (!this.factory.loggingOptions.disableDefaultLogging() && LoggingFactory.defaultLoggerLoaded) { -// FORCE_LOGGER.log(JAVA_LOG_LEVEL_MAP.get(level), message); -// } -// if (level.equals(HttpPipelineLogLevel.ERROR)) { -// SLF4J_LOGGER.error(message); -// } else if (level.equals(HttpPipelineLogLevel.WARNING)) { -// SLF4J_LOGGER.warn(message); -// } else if (level.equals(HttpPipelineLogLevel.INFO)) { -// SLF4J_LOGGER.info(message); -// } -// } -// -// /* -// Check the HttpPipelineLogger, SLF4J Logger, and Java Logger -// */ -// private boolean shouldLog(HttpPipelineLogLevel level) { -// // Default log Warnings and Errors as long as default logging is enabled. -// if ((level.equals(HttpPipelineLogLevel.WARNING) || level.equals(HttpPipelineLogLevel.ERROR)) -// && !this.factory.loggingOptions.disableDefaultLogging() && LoggingFactory.defaultLoggerLoaded) { -// return true; -// } -// -// // The user has configured the HttpPipelineLogger to log at this level. -// if (this.options.shouldLog(level)) { -// return true; -// } -// -// // The SLF4J logger is configured at the given level. -// if ((level.equals(HttpPipelineLogLevel.INFO) && SLF4J_LOGGER.isInfoEnabled()) -// || (level.equals(HttpPipelineLogLevel.WARNING) && SLF4J_LOGGER.isWarnEnabled()) -// || (level.equals(HttpPipelineLogLevel.ERROR) && SLF4J_LOGGER.isErrorEnabled())) { -// return true; -// } -// -// return false; -// } -// } -//} diff --git a/storage/client/src/main/java/com/azure/storage/blob/LoggingOptions.java b/storage/client/src/main/java/com/azure/storage/blob/LoggingOptions.java deleted file mode 100644 index 50e0aa1dd51ff..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/LoggingOptions.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -/** - * Options to configure the {@link LoggingPolicy}. Please refer to the Factory for more information. - */ -final class LoggingOptions { - - /** - * Default logging options. {@code MinDurationToLogSlowRequestsInMs} is set to 3000; - */ - public static final long defaultMinDurationToLogSlowRequests = 3000; - - private final long minDurationToLogSlowRequestsInMs; - - private final boolean disableDefaultLogging; - - public LoggingOptions() { - this(defaultMinDurationToLogSlowRequests); - } - - /** - * Creates a new {@link LoggingOptions} object. - * - * @param minDurationToLogSlowRequestsInMs - * The duration after which a tried operation will be logged as a warning. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=pipeline_options "Sample code for LoggingOptions constructor")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public LoggingOptions(long minDurationToLogSlowRequestsInMs) { - this(minDurationToLogSlowRequestsInMs, false); - } - - /** - * Creates a new {@link LoggingOptions} object. - * - * @param minDurationToLogSlowRequestsInMs - * The duration after which a tried operation will be logged as a warning. - * @param disableDefaultLogging - * By default, this library will automatically log warnings and errors to some files in the system's temp - * directory. The size of these files is bounded to a few dozen MB and should not impose a burden on the - * system. It is strongly recommended to leave these logs enabled for customer support reasons, but if - * the user desires a different logging story and enables logging via the HttpPipelineLogger or SLF4J, then - * it should be safe to disable default logging. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=pipeline_options "Sample code for LoggingOptions constructor")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public LoggingOptions(long minDurationToLogSlowRequestsInMs, boolean disableDefaultLogging) { - this.minDurationToLogSlowRequestsInMs = minDurationToLogSlowRequestsInMs; - this.disableDefaultLogging = disableDefaultLogging; - } - - /** - * @return The duration after which a tried operation will be logged as a warning. - */ - public long minDurationToLogSlowRequestsInMs() { - return minDurationToLogSlowRequestsInMs; - } - - public boolean disableDefaultLogging() { - return disableDefaultLogging; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/Metadata.java b/storage/client/src/main/java/com/azure/storage/blob/Metadata.java deleted file mode 100644 index be84b52046759..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/Metadata.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import java.util.HashMap; -import java.util.Map; - -/** - * Contains metadata key/value pairs to be associated with a storage resource. The user may store any additional - * information about the resource that they like using this map. It is passed to create and setMetadata methods on any - * URL type. Null may be passed to set no metadata. - */ -public final class Metadata extends HashMap { - - // The Metadata is an offshoot of extending HashMap, which implements Serializable. - private static final long serialVersionUID = -6557244540575247796L; - - public Metadata() { - super(); - } - - public Metadata(Map m) { - super(m); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/PageBlobAccessConditions.java b/storage/client/src/main/java/com/azure/storage/blob/PageBlobAccessConditions.java deleted file mode 100644 index b1e0e5a82fa33..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/PageBlobAccessConditions.java +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.ModifiedAccessConditions; -import com.azure.storage.blob.models.SequenceNumberAccessConditions; - -/** - * This class contains values that restrict the successful completion of PageBlob operations to certain conditions. - * It may be set to null if no access conditions are desired. - *

- * Please refer to the request header section - * here for more conceptual information. - */ -public final class PageBlobAccessConditions { - - private SequenceNumberAccessConditions sequenceNumberAccessConditions; - - private ModifiedAccessConditions modifiedAccessConditions; - - private LeaseAccessConditions leaseAccessConditions; - - /** - * Creates an instance which has fields set to non-null, empty values. - */ - public PageBlobAccessConditions() { - this.sequenceNumberAccessConditions = new SequenceNumberAccessConditions(); - this.modifiedAccessConditions = new ModifiedAccessConditions(); - this.leaseAccessConditions = new LeaseAccessConditions(); - } - - /** - * Access conditions that will fail the request if the sequence number does not meet the provided condition. - */ - public SequenceNumberAccessConditions sequenceNumberAccessConditions() { - return sequenceNumberAccessConditions; - } - - /** - * Access conditions that will fail the request if the sequence number does not meet the provided condition. - */ - public PageBlobAccessConditions withSequenceNumberAccessConditions( - SequenceNumberAccessConditions sequenceNumberAccessConditions) { - this.sequenceNumberAccessConditions = sequenceNumberAccessConditions; - return this; - } - - /** - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used to - * construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - */ - public ModifiedAccessConditions modifiedAccessConditions() { - return modifiedAccessConditions; - } - - /** - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used to - * construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - */ - public PageBlobAccessConditions withModifiedAccessConditions(ModifiedAccessConditions modifiedAccessConditions) { - this.modifiedAccessConditions = modifiedAccessConditions; - return this; - } - - /** - * By setting lease access conditions, requests will fail if the provided lease does not match the active lease on - * the blob. - */ - public LeaseAccessConditions leaseAccessConditions() { - return leaseAccessConditions; - } - - /** - * By setting lease access conditions, requests will fail if the provided lease does not match the active lease on - * the blob. - */ - public PageBlobAccessConditions withLeaseAccessConditions(LeaseAccessConditions leaseAccessConditions) { - this.leaseAccessConditions = leaseAccessConditions; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java b/storage/client/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java deleted file mode 100644 index 99f93833a0b23..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/PageBlobAsyncClient.java +++ /dev/null @@ -1,529 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.rest.ResponseBase; -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.BlobHTTPHeaders; -import com.azure.storage.blob.models.CopyStatusType; -import com.azure.storage.blob.models.ModifiedAccessConditions; -import com.azure.storage.blob.models.PageBlobClearPagesHeaders; -import com.azure.storage.blob.models.PageBlobCreateHeaders; -import com.azure.storage.blob.models.PageBlobResizeHeaders; -import com.azure.storage.blob.models.PageBlobUpdateSequenceNumberHeaders; -import com.azure.storage.blob.models.PageBlobUploadPagesFromURLHeaders; -import com.azure.storage.blob.models.PageBlobUploadPagesHeaders; -import com.azure.storage.blob.models.PageRange; -import com.azure.storage.blob.models.SequenceNumberActionType; -import com.azure.storage.blob.models.SourceModifiedAccessConditions; -import io.netty.buffer.ByteBuf; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.net.URL; - -/** - * Client to a page blob. It may only be instantiated through a {@link PageBlobClientBuilder}, via - * the method {@link BlobAsyncClient#asPageBlobAsyncClient()}, or via the method - * {@link ContainerAsyncClient#getPageBlobAsyncClient(String)}. This class does not hold - * any state about a particular blob, but is instead a convenient way of sending appropriate - * requests to the resource on the service. - * - *

- * This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient}, - * and operations on the service are available on {@link StorageAsyncClient}. - * - *

- * Please refer - * to the Azure Docs - * for more information. - * - *

- * Note this client is an async client that returns reactive responses from Spring Reactor Core - * project (https://projectreactor.io/). Calling the methods in this client will NOT - * start the actual network operation, until {@code .subscribe()} is called on the reactive response. - * You can simply convert one of these responses to a {@link java.util.concurrent.CompletableFuture} - * object through {@link Mono#toFuture()}. - */ -public final class PageBlobAsyncClient extends BlobAsyncClient { - - private PageBlobAsyncRawClient pageBlobAsyncRawClient; - - /** - * Indicates the number of bytes in a page. - */ - public static final int PAGE_BYTES = 512; - - /** - * Indicates the maximum number of bytes that may be sent in a call to putPage. - */ - public static final int MAX_PUT_PAGES_BYTES = 4 * Constants.MB; - - /** - * Package-private constructor for use by {@link PageBlobClientBuilder}. - * @param azureBlobStorage the API client for blob storage API - */ - PageBlobAsyncClient(AzureBlobStorageImpl azureBlobStorage) { - super(azureBlobStorage); - this.pageBlobAsyncRawClient = new PageBlobAsyncRawClient(azureBlobStorage); - } - - /** - * @return a new client {@link PageBlobClientBuilder} instance. - */ - public static PageBlobClientBuilder builder() { - return new PageBlobClientBuilder(); - } - - - /** - * Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. - * For more information, see the - * Azure Docs. - * - * @param size - * Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a - * 512-byte boundary. - * - * @return - * A reactive response containing the information of the created page blob. - */ - public Mono create(long size) { - return this.create(size, null, null, null, null, null); - } - - /** - * Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. - * For more information, see the - * Azure Docs. - * - * @param size - * Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a - * 512-byte boundary. - * @param sequenceNumber - * A user-controlled value that you can use to track requests. The value of the sequence number must be - * between 0 and 2^63 - 1.The default value is 0. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the information of the created page blob. - */ - public Mono create(long size, Long sequenceNumber, BlobHTTPHeaders headers, - Metadata metadata, BlobAccessConditions accessConditions, Context context) { - return pageBlobAsyncRawClient - .create(size, sequenceNumber, headers, metadata, accessConditions, context) - .map(ResponseBase::deserializedHeaders); - } - - /** - * Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512. - * For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset must - * be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges are - * 0-511, 512-1023, etc. - * @param body - * The data to upload. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * - * @return - * A reactive response containing the information of the uploaded pages. - */ - public Mono uploadPages(PageRange pageRange, Flux body) { - return this.uploadPages(pageRange, body, null, null); - } - - /** - * Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512. - * For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * @param body - * The data to upload. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * @param pageBlobAccessConditions - * {@link PageBlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the information of the uploaded pages. - */ - public Mono uploadPages(PageRange pageRange, Flux body, - PageBlobAccessConditions pageBlobAccessConditions, Context context) { - return pageBlobAsyncRawClient - .uploadPages(pageRange, body, pageBlobAccessConditions, context) - .map(ResponseBase::deserializedHeaders); - } - - /** - * Writes 1 or more pages from the source page blob to this page blob. The start and end offsets must be a multiple - * of 512. - * For more information, see the - * Azure Docs. - *

- * - * @param range - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceOffset - * The source offset to copy from. Pass null or 0 to copy from the beginning of source page blob. - * - * @return - * A reactive response containing the information of the uploaded pages. - */ - public Mono uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset) { - return this.uploadPagesFromURL(range, sourceURL, sourceOffset, null, null, - null, null); - } - - /** - * Writes 1 or more pages from the source page blob to this page blob. The start and end offsets must be a multiple - * of 512. - * For more information, see the - * Azure Docs. - *

- * - * @param range - * The destination {@link PageRange} range. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceOffset - * The source offset to copy from. Pass null or 0 to copy from the beginning of source blob. - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param destAccessConditions - * {@link PageBlobAccessConditions} - * @param sourceAccessConditions - * {@link SourceModifiedAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the information of the uploaded pages. - */ - public Mono uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset, - byte[] sourceContentMD5, PageBlobAccessConditions destAccessConditions, - SourceModifiedAccessConditions sourceAccessConditions, Context context) { - - return pageBlobAsyncRawClient - .uploadPagesFromURL(range, sourceURL, sourceOffset, sourceContentMD5, destAccessConditions, sourceAccessConditions, context) - .map(ResponseBase::deserializedHeaders); - } - - /** - * Frees the specified pages from the page blob. - * For more information, see the - * Azure Docs. - * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * - * @return - * A reactive response containing the information of the cleared pages. - */ - public Mono clearPages(PageRange pageRange) { - return this.clearPages(pageRange, null, null); - } - - /** - * Frees the specified pages from the page blob. - * For more information, see the - * Azure Docs. - * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * @param pageBlobAccessConditions - * {@link PageBlobAccessConditions} - * - * @return - * A reactive response containing the information of the cleared pages. - */ - public Mono clearPages(PageRange pageRange, - PageBlobAccessConditions pageBlobAccessConditions, Context context) { - return pageBlobAsyncRawClient - .clearPages(pageRange, pageBlobAccessConditions, context) - .map(ResponseBase::deserializedHeaders); - } - - /** - * Returns the list of valid page ranges for a page blob or snapshot of a page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * - * @return - * A reactive response containing the information of the cleared pages. - */ - public Flux getPageRanges(BlobRange blobRange) { - return this.getPageRanges(blobRange, null, null); - } - - /** - * Returns the list of valid page ranges for a page blob or snapshot of a page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response emitting all the page ranges. - */ - public Flux getPageRanges(BlobRange blobRange, - BlobAccessConditions accessConditions, Context context) { - return pageBlobAsyncRawClient - .getPageRanges(blobRange, accessConditions, context) - .flatMapMany(response -> Flux.fromIterable(response.value().pageRange())); - } - - /** - * Gets the collection of page ranges that differ between a specified snapshot and this page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * @param prevSnapshot - * Specifies that the response will contain only pages that were changed between target blob and previous - * snapshot. Changed pages include both updated and cleared pages. The target - * blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. - * - * @return - * A reactive response emitting all the different page ranges. - */ - public Flux getPageRangesDiff(BlobRange blobRange, String prevSnapshot) { - return this.getPageRangesDiff(blobRange, prevSnapshot, null, null); - } - - /** - * Gets the collection of page ranges that differ between a specified snapshot and this page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * @param prevSnapshot - * Specifies that the response will contain only pages that were changed between target blob and previous - * snapshot. Changed pages include both updated and cleared pages. The target - * blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response emitting all the different page ranges. - */ - public Flux getPageRangesDiff(BlobRange blobRange, String prevSnapshot, - BlobAccessConditions accessConditions, Context context) { - return pageBlobAsyncRawClient - .getPageRangesDiff(blobRange, prevSnapshot, accessConditions, context) - .flatMapMany(response -> Flux.fromIterable(response.value().pageRange())); - } - - /** - * Resizes the page blob to the specified size (which must be a multiple of 512). - * For more information, see the Azure Docs. - * - * @param size - * Resizes a page blob to the specified size. If the specified value is less than the current size of the - * blob, then all pages above the specified value are cleared. - * - * @return - * A reactive response emitting the resized page blob. - */ - public Mono resize(long size) { - return this.resize(size, null, null); - } - - /** - * Resizes the page blob to the specified size (which must be a multiple of 512). - * For more information, see the Azure Docs. - * - * @param size - * Resizes a page blob to the specified size. If the specified value is less than the current size of the - * blob, then all pages above the specified value are cleared. - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response emitting the resized page blob. - */ - public Mono resize(long size, BlobAccessConditions accessConditions, Context context) { - return pageBlobAsyncRawClient - .resize(size, accessConditions, context) - .map(ResponseBase::deserializedHeaders); - } - - /** - * Sets the page blob's sequence number. - * For more information, see the Azure Docs. - * - * @param action - * Indicates how the service should modify the blob's sequence number. - * @param sequenceNumber - * The blob's sequence number. The sequence number is a user-controlled property that you can use to track - * requests and manage concurrency issues. - * - * @return - * A reactive response emitting the updated page blob. - */ - public Mono updateSequenceNumber(SequenceNumberActionType action, - Long sequenceNumber) { - return this.updateSequenceNumber(action, sequenceNumber, null, null); - } - - /** - * Sets the page blob's sequence number. - * For more information, see the Azure Docs. - * - * @param action - * Indicates how the service should modify the blob's sequence number. - * @param sequenceNumber - * The blob's sequence number. The sequence number is a user-controlled property that you can use to track - * requests and manage concurrency issues. - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response emitting the updated page blob. - */ - public Mono updateSequenceNumber(SequenceNumberActionType action, - Long sequenceNumber, BlobAccessConditions accessConditions, Context context) { - return pageBlobAsyncRawClient - .updateSequenceNumber(action, sequenceNumber, accessConditions, context) - .map(ResponseBase::deserializedHeaders); - } - - /** - * Begins an operation to start an incremental copy from one page blob's snapshot to this page - * blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are - * transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read - * or copied from as usual. For more information, see - * the Azure Docs here and - * here. - * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. - * - * @return - * A reactive response emitting the copy status. - */ - public Mono copyIncremental(URL source, String snapshot) { - return this.copyIncremental(source, snapshot, null, null); - } - - /** - * Begins an operation to start an incremental copy from one page blob's snapshot to this page - * blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are - * transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read - * or copied from as usual. For more information, see - * the Azure Docs here and - * here. - * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return - * A reactive response emitting the copy status. - */ - public Mono copyIncremental(URL source, String snapshot, - ModifiedAccessConditions modifiedAccessConditions, Context context) { - return pageBlobAsyncRawClient - .copyIncremental(source, snapshot, modifiedAccessConditions, context) - .map(response -> response.deserializedHeaders().copyStatus()); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/PageBlobAsyncRawClient.java b/storage/client/src/main/java/com/azure/storage/blob/PageBlobAsyncRawClient.java deleted file mode 100644 index 6b19f1f00a415..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/PageBlobAsyncRawClient.java +++ /dev/null @@ -1,671 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.implementation.http.UrlBuilder; -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.BlobHTTPHeaders; -import com.azure.storage.blob.models.ModifiedAccessConditions; -import com.azure.storage.blob.models.PageBlobsClearPagesResponse; -import com.azure.storage.blob.models.PageBlobsCopyIncrementalResponse; -import com.azure.storage.blob.models.PageBlobsCreateResponse; -import com.azure.storage.blob.models.PageBlobsGetPageRangesDiffResponse; -import com.azure.storage.blob.models.PageBlobsGetPageRangesResponse; -import com.azure.storage.blob.models.PageBlobsResizeResponse; -import com.azure.storage.blob.models.PageBlobsUpdateSequenceNumberResponse; -import com.azure.storage.blob.models.PageBlobsUploadPagesFromURLResponse; -import com.azure.storage.blob.models.PageBlobsUploadPagesResponse; -import com.azure.storage.blob.models.PageRange; -import com.azure.storage.blob.models.SequenceNumberActionType; -import com.azure.storage.blob.models.SourceModifiedAccessConditions; -import io.netty.buffer.ByteBuf; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.net.MalformedURLException; -import java.net.URL; - -import static com.azure.storage.blob.Utility.postProcessResponse; - -/** - * Represents a URL to a page blob. It may be obtained by direct construction or via the create method on a - * {@link ContainerAsyncClient} object. This class does not hold any state about a particular blob but is instead a convenient - * way of sending off appropriate requests to the resource on the service. Please refer to the - * Azure Docs - * for more information. - */ -final class PageBlobAsyncRawClient extends BlobAsyncRawClient { - - /** - * Indicates the number of bytes in a page. - */ - public static final int PAGE_BYTES = 512; - - /** - * Indicates the maximum number of bytes that may be sent in a call to putPage. - */ - public static final int MAX_PUT_PAGES_BYTES = 4 * Constants.MB; - - /** - * Creates a {@code PageBlobAsyncRawClient} object pointing to the account specified by the URL and using the provided - * pipeline to make HTTP requests. - * - */ - public PageBlobAsyncRawClient(AzureBlobStorageImpl azureBlobStorage) { - super(azureBlobStorage); - } - - private static String pageRangeToString(PageRange pageRange) { - if (pageRange.start() < 0 || pageRange.end() <= 0) { - throw new IllegalArgumentException("PageRange's start and end values must be greater than or equal to " - + "0 if specified."); - } - if (pageRange.start() % PageBlobAsyncRawClient.PAGE_BYTES != 0) { - throw new IllegalArgumentException("PageRange's start value must be a multiple of 512."); - } - if (pageRange.end() % PageBlobAsyncRawClient.PAGE_BYTES != PageBlobAsyncRawClient.PAGE_BYTES - 1) { - throw new IllegalArgumentException("PageRange's end value must be 1 less than a multiple of 512."); - } - if (pageRange.end() <= pageRange.start()) { - throw new IllegalArgumentException("PageRange's End value must be after the start."); - } - return new StringBuilder("bytes=").append(pageRange.start()).append('-').append(pageRange.end()).toString(); - } - - /** - * Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. - * For more information, see the - * Azure Docs. - * - * @param size - * Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a - * 512-byte boundary. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.create")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono create(long size) { - return this.create(size, null, null, null, null, null); - } - - /** - * Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. - * For more information, see the - * Azure Docs. - * - * @param size - * Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a - * 512-byte boundary. - * @param sequenceNumber - * A user-controlled value that you can use to track requests. The value of the sequence number must be - * between 0 and 2^63 - 1.The default value is 0. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.create")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono create(long size, Long sequenceNumber, BlobHTTPHeaders headers, - Metadata metadata, BlobAccessConditions accessConditions, Context context) { - accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; - - if (size % PageBlobAsyncRawClient.PAGE_BYTES != 0) { - // Throwing is preferred to Single.error because this will error out immediately instead of waiting until - // subscription. - throw new IllegalArgumentException("size must be a multiple of PageBlobAsyncRawClient.PAGE_BYTES."); - } - if (sequenceNumber != null && sequenceNumber < 0) { - // Throwing is preferred to Single.error because this will error out immediately instead of waiting until - // subscription. - throw new IllegalArgumentException("SequenceNumber must be greater than or equal to 0."); - } - metadata = metadata == null ? new Metadata() : metadata; - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.pageBlobs().createWithRestResponseAsync(null, - null, 0, size, null, metadata, null, null, - null, sequenceNumber, null, headers, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), context)); - } - - /** - * Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512. - * For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset must - * be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges are - * 0-511, 512-1023, etc. - * @param body - * The data to upload. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.uploadPages")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono uploadPages(PageRange pageRange, Flux body) { - return this.uploadPages(pageRange, body, null, null); - } - - /** - * Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512. - * For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * @param body - * The data to upload. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * @param pageBlobAccessConditions - * {@link PageBlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.uploadPages")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono uploadPages(PageRange pageRange, Flux body, - PageBlobAccessConditions pageBlobAccessConditions, Context context) { - pageBlobAccessConditions = pageBlobAccessConditions == null ? new PageBlobAccessConditions() - : pageBlobAccessConditions; - - if (pageRange == null) { - // Throwing is preferred to Single.error because this will error out immediately instead of waiting until - // subscription. - throw new IllegalArgumentException("pageRange cannot be null."); - } - String pageRangeStr = pageRangeToString(pageRange); - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.pageBlobs().uploadPagesWithRestResponseAsync(null, - null, body, pageRange.end() - pageRange.start() + 1, null, - null, pageRangeStr, null, null, null, null, - pageBlobAccessConditions.leaseAccessConditions(), pageBlobAccessConditions.sequenceNumberAccessConditions(), - pageBlobAccessConditions.modifiedAccessConditions(), context)); - } - - /** - * Writes 1 or more pages from the source page blob to this page blob. The start and end offsets must be a multiple - * of 512. - * For more information, see the - * Azure Docs. - *

- * - * @param range - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceOffset - * The source offset to copy from. Pass null or 0 to copy from the beginning of source page blob. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_from_url "Sample code for PageBlobAsyncRawClient.uploadPagesFromURL")] - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset) { - return this.uploadPagesFromURL(range, sourceURL, sourceOffset, null, null, - null, null); - } - - /** - * Writes 1 or more pages from the source page blob to this page blob. The start and end offsets must be a multiple - * of 512. - * For more information, see the - * Azure Docs. - *

- * - * @param range - * The destination {@link PageRange} range. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceOffset - * The source offset to copy from. Pass null or 0 to copy from the beginning of source blob. - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param destAccessConditions - * {@link PageBlobAccessConditions} - * @param sourceAccessConditions - * {@link SourceModifiedAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_from_url "Sample code for PageBlobAsyncRawClient.uploadPagesFromURL")] - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset, - byte[] sourceContentMD5, PageBlobAccessConditions destAccessConditions, - SourceModifiedAccessConditions sourceAccessConditions, Context context) { - - if (range == null) { - // Throwing is preferred to Single.error because this will error out immediately instead of waiting until - // subscription. - throw new IllegalArgumentException("range cannot be null."); - } - - String rangeString = pageRangeToString(range); - - if (sourceOffset == null) { - sourceOffset = 0L; - } - - String sourceRangeString = pageRangeToString(new PageRange().start(sourceOffset).end(sourceOffset + (range.end() - range.start()))); - - destAccessConditions = destAccessConditions == null ? new PageBlobAccessConditions() : destAccessConditions; - - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.pageBlobs().uploadPagesFromURLWithRestResponseAsync( - null, null, sourceURL, sourceRangeString, 0, rangeString, sourceContentMD5, - null, null, destAccessConditions.leaseAccessConditions(), - destAccessConditions.sequenceNumberAccessConditions(), destAccessConditions.modifiedAccessConditions(), - sourceAccessConditions, context)); - } - - /** - * Frees the specified pages from the page blob. - * For more information, see the - * Azure Docs. - * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.clearPages")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono clearPages(PageRange pageRange) { - return this.clearPages(pageRange, null, null); - } - - /** - * Frees the specified pages from the page blob. - * For more information, see the - * Azure Docs. - * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * @param pageBlobAccessConditions - * {@link PageBlobAccessConditions} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.clearPages")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono clearPages(PageRange pageRange, - PageBlobAccessConditions pageBlobAccessConditions, Context context) { - pageBlobAccessConditions = pageBlobAccessConditions == null ? new PageBlobAccessConditions() - : pageBlobAccessConditions; - if (pageRange == null) { - // Throwing is preferred to Single.error because this will error out immediately instead of waiting until - // subscription. - throw new IllegalArgumentException("pageRange cannot be null."); - } - String pageRangeStr = pageRangeToString(pageRange); - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.pageBlobs().clearPagesWithRestResponseAsync(null, - null, 0, null, pageRangeStr, null, - pageBlobAccessConditions.leaseAccessConditions(), pageBlobAccessConditions.sequenceNumberAccessConditions(), - pageBlobAccessConditions.modifiedAccessConditions(), context)); - } - - /** - * Returns the list of valid page ranges for a page blob or snapshot of a page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.getPageRanges")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getPageRanges(BlobRange blobRange) { - return this.getPageRanges(blobRange, null, null); - } - - /** - * Returns the list of valid page ranges for a page blob or snapshot of a page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.getPageRanges")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getPageRanges(BlobRange blobRange, - BlobAccessConditions accessConditions, Context context) { - blobRange = blobRange == null ? new BlobRange(0) : blobRange; - accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.pageBlobs().getPageRangesWithRestResponseAsync( - null, null, null, null, null, blobRange.toHeaderValue(), - null, accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), - context)); - } - - /** - * Gets the collection of page ranges that differ between a specified snapshot and this page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * @param prevSnapshot - * Specifies that the response will contain only pages that were changed between target blob and previous - * snapshot. Changed pages include both updated and cleared pages. The target - * blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_diff "Sample code for PageBlobAsyncRawClient.getPageRangesDiff")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getPageRangesDiff(BlobRange blobRange, String prevSnapshot) { - return this.getPageRangesDiff(blobRange, prevSnapshot, null, null); - } - - /** - * Gets the collection of page ranges that differ between a specified snapshot and this page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * @param prevSnapshot - * Specifies that the response will contain only pages that were changed between target blob and previous - * snapshot. Changed pages include both updated and cleared pages. The target - * blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_diff "Sample code for PageBlobAsyncRawClient.getPageRangesDiff")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getPageRangesDiff(BlobRange blobRange, String prevSnapshot, - BlobAccessConditions accessConditions, Context context) { - blobRange = blobRange == null ? new BlobRange(0) : blobRange; - accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; - context = context == null ? Context.NONE : context; - - if (prevSnapshot == null) { - throw new IllegalArgumentException("prevSnapshot cannot be null"); - } - - return postProcessResponse(this.azureBlobStorage.pageBlobs().getPageRangesDiffWithRestResponseAsync( - null, null, null, null, null, prevSnapshot, - blobRange.toHeaderValue(), null, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), context)); - } - - /** - * Resizes the page blob to the specified size (which must be a multiple of 512). - * For more information, see the Azure Docs. - * - * @param size - * Resizes a page blob to the specified size. If the specified value is less than the current size of the - * blob, then all pages above the specified value are cleared. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.resize")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono resize(long size) { - return this.resize(size, null, null); - } - - /** - * Resizes the page blob to the specified size (which must be a multiple of 512). - * For more information, see the Azure Docs. - * - * @param size - * Resizes a page blob to the specified size. If the specified value is less than the current size of the - * blob, then all pages above the specified value are cleared. - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.resize")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono resize(long size, BlobAccessConditions accessConditions, Context context) { - if (size % PageBlobAsyncRawClient.PAGE_BYTES != 0) { - // Throwing is preferred to Single.error because this will error out immediately instead of waiting until - // subscription. - throw new IllegalArgumentException("size must be a multiple of PageBlobAsyncRawClient.PAGE_BYTES."); - } - accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; - context = context == null ? Context.NONE : context; - - return postProcessResponse(this.azureBlobStorage.pageBlobs().resizeWithRestResponseAsync(null, - null, size, null, null, accessConditions.leaseAccessConditions(), - accessConditions.modifiedAccessConditions(), context)); - } - - /** - * Sets the page blob's sequence number. - * For more information, see the Azure Docs. - * - * @param action - * Indicates how the service should modify the blob's sequence number. - * @param sequenceNumber - * The blob's sequence number. The sequence number is a user-controlled property that you can use to track - * requests and manage concurrency issues. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.updateSequenceNumber")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono updateSequenceNumber(SequenceNumberActionType action, - Long sequenceNumber) { - return this.updateSequenceNumber(action, sequenceNumber, null, null); - } - - /** - * Sets the page blob's sequence number. - * For more information, see the Azure Docs. - * - * @param action - * Indicates how the service should modify the blob's sequence number. - * @param sequenceNumber - * The blob's sequence number. The sequence number is a user-controlled property that you can use to track - * requests and manage concurrency issues. - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.updateSequenceNumber")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono updateSequenceNumber(SequenceNumberActionType action, - Long sequenceNumber, BlobAccessConditions accessConditions, Context context) { - if (sequenceNumber != null && sequenceNumber < 0) { - // Throwing is preferred to Single.error because this will error out immediately instead of waiting until - // subscription. - throw new IllegalArgumentException("SequenceNumber must be greater than or equal to 0."); - } - accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; - sequenceNumber = action == SequenceNumberActionType.INCREMENT ? null : sequenceNumber; - context = context == null ? Context.NONE : context; - - return postProcessResponse( - this.azureBlobStorage.pageBlobs().updateSequenceNumberWithRestResponseAsync(null, - null, action, null, sequenceNumber, null, - accessConditions.leaseAccessConditions(), accessConditions.modifiedAccessConditions(), context)); - } - - /** - * Begins an operation to start an incremental copy from one page blob's snapshot to this page - * blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are - * transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read - * or copied from as usual. For more information, see - * the Azure Docs here and - * here. - * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. - * - * @return Emits the successful response. - */ - public Mono copyIncremental(URL source, String snapshot) { - return this.copyIncremental(source, snapshot, null, null); - } - - /** - * Begins an operation to start an incremental copy from one page blob's snapshot to this page - * blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are - * transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read - * or copied from as usual. For more information, see - * the Azure Docs here and - * here. - * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - */ - public Mono copyIncremental(URL source, String snapshot, - ModifiedAccessConditions modifiedAccessConditions, Context context) { - context = context == null ? Context.NONE : context; - - UrlBuilder builder = UrlBuilder.parse(source); - builder.setQueryParameter(Constants.SNAPSHOT_QUERY_PARAMETER, snapshot); - try { - source = builder.toURL(); - } catch (MalformedURLException e) { - // We are parsing a valid url and adding a query parameter. If this fails, we can't recover. - throw new Error(e); - } - return postProcessResponse(this.azureBlobStorage.pageBlobs().copyIncrementalWithRestResponseAsync( - null, null, source, null, null, modifiedAccessConditions, context)); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/PageBlobClient.java b/storage/client/src/main/java/com/azure/storage/blob/PageBlobClient.java deleted file mode 100644 index 216f2758896d3..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/PageBlobClient.java +++ /dev/null @@ -1,566 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.BlobHTTPHeaders; -import com.azure.storage.blob.models.CopyStatusType; -import com.azure.storage.blob.models.ModifiedAccessConditions; -import com.azure.storage.blob.models.PageBlobClearPagesHeaders; -import com.azure.storage.blob.models.PageBlobCreateHeaders; -import com.azure.storage.blob.models.PageBlobResizeHeaders; -import com.azure.storage.blob.models.PageBlobUpdateSequenceNumberHeaders; -import com.azure.storage.blob.models.PageBlobUploadPagesFromURLHeaders; -import com.azure.storage.blob.models.PageBlobUploadPagesHeaders; -import com.azure.storage.blob.models.PageRange; -import com.azure.storage.blob.models.SequenceNumberActionType; -import com.azure.storage.blob.models.SourceModifiedAccessConditions; -import io.netty.buffer.ByteBuf; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.net.URL; -import java.time.Duration; - -/** - * Client to a page blob. It may only be instantiated through a {@link PageBlobClientBuilder}, via - * the method {@link BlobClient#asPageBlobClient()}, or via the method - * {@link ContainerClient#getPageBlobClient(String)}. This class does not hold - * any state about a particular blob, but is instead a convenient way of sending appropriate - * requests to the resource on the service. - * - *

- * This client contains operations on a blob. Operations on a container are available on {@link ContainerClient}, - * and operations on the service are available on {@link StorageClient}. - * - *

- * Please refer to the Azure Docs - * for more information. - */ -public final class PageBlobClient extends BlobClient { - - private PageBlobAsyncClient pageBlobAsyncClient; - - /** - * Indicates the number of bytes in a page. - */ - public static final int PAGE_BYTES = 512; - - /** - * Indicates the maximum number of bytes that may be sent in a call to putPage. - */ - public static final int MAX_PUT_PAGES_BYTES = 4 * Constants.MB; - - /** - * Package-private constructor for use by {@link PageBlobClientBuilder}. - * @param azureBlobStorage the API client for blob storage API - */ - PageBlobClient(AzureBlobStorageImpl azureBlobStorage) { - super(azureBlobStorage); - this.pageBlobAsyncClient = new PageBlobAsyncClient(azureBlobStorage); - } - - /** - * @return a new client {@link PageBlobClientBuilder} instance. - */ - public static PageBlobClientBuilder pageBlobClientBuilder() { - return new PageBlobClientBuilder(); - } - - // TODO: Figure out if this method needs to change to public to access method in wrappers - private static String pageRangeToString(PageRange pageRange) { - if (pageRange.start() < 0 || pageRange.end() <= 0) { - throw new IllegalArgumentException("PageRange's start and end values must be greater than or equal to " - + "0 if specified."); - } - if (pageRange.start() % PageBlobClient.PAGE_BYTES != 0) { - throw new IllegalArgumentException("PageRange's start value must be a multiple of 512."); - } - if (pageRange.end() % PageBlobClient.PAGE_BYTES != PageBlobClient.PAGE_BYTES - 1) { - throw new IllegalArgumentException("PageRange's end value must be 1 less than a multiple of 512."); - } - if (pageRange.end() <= pageRange.start()) { - throw new IllegalArgumentException("PageRange's End value must be after the start."); - } - return new StringBuilder("bytes=").append(pageRange.start()).append('-').append(pageRange.end()).toString(); - } - - /** - * Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. - * For more information, see the - * Azure Docs. - * - * @param size - * Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a - * 512-byte boundary. - * - * @return - * The information of the created page blob. - */ - public PageBlobCreateHeaders create(long size) { - return this.create(size, null, null, null, null, null, null); - } - - /** - * Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. - * For more information, see the - * Azure Docs. - * - * @param size - * Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a - * 512-byte boundary. - * @param sequenceNumber - * A user-controlled value that you can use to track requests. The value of the sequence number must be - * between 0 and 2^63 - 1.The default value is 0. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * The information of the created page blob. - */ - public PageBlobCreateHeaders create(long size, Long sequenceNumber, BlobHTTPHeaders headers, - Metadata metadata, BlobAccessConditions accessConditions, Duration timeout, Context context) { - Mono response = pageBlobAsyncClient.create(size, sequenceNumber, headers, metadata, accessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } - - /** - * Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512. - * For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset must - * be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges are - * 0-511, 512-1023, etc. - * @param body - * The data to upload. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * - * @return - * The information of the uploaded pages. - */ - public PageBlobUploadPagesHeaders uploadPages(PageRange pageRange, Flux body) { - return this.uploadPages(pageRange, body, null, null, null); - } - - /** - * Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512. - * For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * @param body - * The data to upload. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * @param pageBlobAccessConditions - * {@link PageBlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * The information of the uploaded pages. - */ - public PageBlobUploadPagesHeaders uploadPages(PageRange pageRange, Flux body, - PageBlobAccessConditions pageBlobAccessConditions, Duration timeout, Context context) { - Mono response = pageBlobAsyncClient.uploadPages(pageRange, body, pageBlobAccessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } - - /** - * Writes 1 or more pages from the source page blob to this page blob. The start and end offsets must be a multiple - * of 512. - * For more information, see the - * Azure Docs. - *

- * - * @param range - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceOffset - * The source offset to copy from. Pass null or 0 to copy from the beginning of source page blob. - * - * @return - * The information of the uploaded pages. - */ - public PageBlobUploadPagesFromURLHeaders uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset) { - return this.uploadPagesFromURL(range, sourceURL, sourceOffset, null, null, - null, null, null); - } - - /** - * Writes 1 or more pages from the source page blob to this page blob. The start and end offsets must be a multiple - * of 512. - * For more information, see the - * Azure Docs. - *

- * - * @param range - * The destination {@link PageRange} range. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceOffset - * The source offset to copy from. Pass null or 0 to copy from the beginning of source blob. - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param destAccessConditions - * {@link PageBlobAccessConditions} - * @param sourceAccessConditions - * {@link SourceModifiedAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * The information of the uploaded pages. - */ - public PageBlobUploadPagesFromURLHeaders uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset, - byte[] sourceContentMD5, PageBlobAccessConditions destAccessConditions, - SourceModifiedAccessConditions sourceAccessConditions, Duration timeout, Context context) { - - Mono response = pageBlobAsyncClient.uploadPagesFromURL(range, sourceURL, sourceOffset, sourceContentMD5, destAccessConditions, sourceAccessConditions, context); - return timeout == null ? - response.block(): - response.block(timeout); - } - - /** - * Frees the specified pages from the page blob. - * For more information, see the - * Azure Docs. - * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * - * @return - * The information of the cleared pages. - */ - public PageBlobClearPagesHeaders clearPages(PageRange pageRange) { - return this.clearPages(pageRange, null, null, null); - } - - /** - * Frees the specified pages from the page blob. - * For more information, see the - * Azure Docs. - * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * @param pageBlobAccessConditions - * {@link PageBlobAccessConditions} - * - * @return - * The information of the cleared pages. - */ - public PageBlobClearPagesHeaders clearPages(PageRange pageRange, - PageBlobAccessConditions pageBlobAccessConditions, Duration timeout, Context context) { - Mono response = pageBlobAsyncClient.clearPages(pageRange, pageBlobAccessConditions, context); - - return timeout == null ? - response.block(): - response.block(timeout); - } - - /** - * Returns the list of valid page ranges for a page blob or snapshot of a page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * - * @return - * The information of the cleared pages. - */ - public Iterable getPageRanges(BlobRange blobRange) { - return this.getPageRanges(blobRange, null, null, null); - } - - /** - * Returns the list of valid page ranges for a page blob or snapshot of a page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * All the page ranges. - */ - public Iterable getPageRanges(BlobRange blobRange, - BlobAccessConditions accessConditions, Duration timeout, Context context) { - Flux response = pageBlobAsyncClient.getPageRanges(blobRange, accessConditions, context); - return timeout == null? - response.toIterable(): - response.timeout(timeout).toIterable(); - } - - /** - * Gets the collection of page ranges that differ between a specified snapshot and this page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * @param prevSnapshot - * Specifies that the response will contain only pages that were changed between target blob and previous - * snapshot. Changed pages include both updated and cleared pages. The target - * blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. - * - * @return - * All the different page ranges. - */ - public Iterable getPageRangesDiff(BlobRange blobRange, String prevSnapshot) { - return this.getPageRangesDiff(blobRange, prevSnapshot, null, null, null); - } - - /** - * Gets the collection of page ranges that differ between a specified snapshot and this page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * @param prevSnapshot - * Specifies that the response will contain only pages that were changed between target blob and previous - * snapshot. Changed pages include both updated and cleared pages. The target - * blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * All the different page ranges. - */ - public Iterable getPageRangesDiff(BlobRange blobRange, String prevSnapshot, - BlobAccessConditions accessConditions, Duration timeout, Context context) { - Flux response = pageBlobAsyncClient.getPageRangesDiff(blobRange, prevSnapshot, accessConditions, context); - return timeout == null? - response.toIterable(): - response.timeout(timeout).toIterable(); - } - - /** - * Resizes the page blob to the specified size (which must be a multiple of 512). - * For more information, see the Azure Docs. - * - * @param size - * Resizes a page blob to the specified size. If the specified value is less than the current size of the - * blob, then all pages above the specified value are cleared. - * - * @return - * The resized page blob. - */ - public PageBlobResizeHeaders resize(long size) { - return this.resize(size, null, null, null); - } - - /** - * Resizes the page blob to the specified size (which must be a multiple of 512). - * For more information, see the Azure Docs. - * - * @param size - * Resizes a page blob to the specified size. If the specified value is less than the current size of the - * blob, then all pages above the specified value are cleared. - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * The resized page blob. - */ - public PageBlobResizeHeaders resize(long size, BlobAccessConditions accessConditions, Duration timeout, Context context) { - Mono response = pageBlobAsyncClient.resize(size, accessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } - - /** - * Sets the page blob's sequence number. - * For more information, see the Azure Docs. - * - * @param action - * Indicates how the service should modify the blob's sequence number. - * @param sequenceNumber - * The blob's sequence number. The sequence number is a user-controlled property that you can use to track - * requests and manage concurrency issues. - * - * @return - * The updated page blob. - */ - public PageBlobUpdateSequenceNumberHeaders updateSequenceNumber(SequenceNumberActionType action, - Long sequenceNumber) { - return this.updateSequenceNumber(action, sequenceNumber, null, null,null); - } - - /** - * Sets the page blob's sequence number. - * For more information, see the Azure Docs. - * - * @param action - * Indicates how the service should modify the blob's sequence number. - * @param sequenceNumber - * The blob's sequence number. The sequence number is a user-controlled property that you can use to track - * requests and manage concurrency issues. - * @param accessConditions - * {@link BlobAccessConditions} - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * The updated page blob. - */ - public PageBlobUpdateSequenceNumberHeaders updateSequenceNumber(SequenceNumberActionType action, - Long sequenceNumber, BlobAccessConditions accessConditions, Duration timeout, Context context) { - Mono response = pageBlobAsyncClient.updateSequenceNumber(action, sequenceNumber, accessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } - - /** - * Begins an operation to start an incremental copy from one page blob's snapshot to this page - * blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are - * transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read - * or copied from as usual. For more information, see - * the Azure Docs here and - * here. - * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. - * - * @return - * The copy status. - */ - public CopyStatusType copyIncremental(URL source, String snapshot) { - return this.copyIncremental(source, snapshot, null, null, null); - } - - /** - * Begins an operation to start an incremental copy from one page blob's snapshot to this page - * blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are - * transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read - * or copied from as usual. For more information, see - * the Azure Docs here and - * here. - * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return - * The copy status. - */ - public CopyStatusType copyIncremental(URL source, String snapshot, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { - Mono response = pageBlobAsyncClient.copyIncremental(source, snapshot, modifiedAccessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/PageBlobClientBuilder.java b/storage/client/src/main/java/com/azure/storage/blob/PageBlobClientBuilder.java deleted file mode 100644 index 557cc4cb969e9..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/PageBlobClientBuilder.java +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.util.configuration.Configuration; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLoggingPolicy; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.implementation.util.ImplUtils; -import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * Fluent PageBlobClientBuilder for instantiating a {@link PageBlobClient} or {@link PageBlobAsyncClient}. - * - *

- * An instance of this builder may only be created from static method {@link PageBlobClient#pageBlobClientBuilder()}. - * The following information must be provided on this builder: - * - *

    - *
  • the endpoint through {@code .endpoint()}, including the container name and blob name, in the format of {@code https://{accountName}.blob.core.windows.net/{containerName}/{blobName}}. - *
  • the credential through {@code .credentials()} or {@code .connectionString()} if the container is not publicly accessible. - *
- * - *

- * Once all the configurations are set on this builder, call {@code .buildClient()} to create a - * {@link PageBlobClient} or {@code .buildAsyncClient()} to create a {@link PageBlobAsyncClient}. - */ -public final class PageBlobClientBuilder { - private static final String ACCOUNT_NAME = "AccountName".toLowerCase(); - private static final String ACCOUNT_KEY = "AccountKey".toLowerCase(); - - private final List policies; - - private URL endpoint; - private ICredentials credentials = new AnonymousCredentials(); - private HttpClient httpClient; - private HttpLogDetailLevel logLevel; - private RetryPolicy retryPolicy; - private Configuration configuration; - - public PageBlobClientBuilder() { - retryPolicy = new RetryPolicy(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); - } - - /** - * Constructs an instance of PageBlobAsyncClient based on the configurations stored in the appendBlobClientBuilder. - * @return a new client instance - */ - private AzureBlobStorageImpl buildImpl() { - Objects.requireNonNull(endpoint); - - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - policies.add(new UserAgentPolicy(BlobConfiguration.NAME, BlobConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - policies.add(credentials); // This needs to be a different credential type. - - policies.add(retryPolicy); - - policies.addAll(this.policies); - policies.add(new HttpLoggingPolicy(logLevel)); - - HttpPipeline pipeline = HttpPipeline.builder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); - - return new AzureBlobStorageBuilder() - .url(endpoint.toString()) - .pipeline(pipeline) - .build(); - } - - /** - * @return a {@link PageBlobClient} created from the configurations in this builder. - */ - public PageBlobClient buildClient() { - return new PageBlobClient(buildImpl()); - } - - /** - * @return a {@link PageBlobAsyncClient} created from the configurations in this builder. - */ - public PageBlobAsyncClient buildAsyncClient() { - return new PageBlobAsyncClient(buildImpl()); - } - - /** - * Sets the service endpoint, additionally parses it for information (SAS token, container name) - * @param endpoint URL of the service - * @return the updated PageBlobClientBuilder object - */ - public PageBlobClientBuilder endpoint(String endpoint) { - Objects.requireNonNull(endpoint); - try { - this.endpoint = new URL(endpoint); - } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage Queue endpoint url is malformed."); - } - - return this; - } - - /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials - * @return the updated PageBlobClientBuilder object - */ - public PageBlobClientBuilder credentials(SharedKeyCredentials credentials) { - this.credentials = credentials; - return this; - } - - /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials - * @return the updated PageBlobClientBuilder object - */ - public PageBlobClientBuilder credentials(TokenCredentials credentials) { - this.credentials = credentials; - return this; - } - - /** - * Clears the credentials used to authorize requests sent to the service - * @return the updated PageBlobClientBuilder object - */ - public PageBlobClientBuilder anonymousCredentials() { - this.credentials = new AnonymousCredentials(); - return this; - } - - /** - * Sets the connection string for the service, parses it for authentication information (account name, account key) - * @param connectionString connection string from access keys section - * @return the updated PageBlobClientBuilder object - */ - public PageBlobClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - - Map connectionKVPs = new HashMap<>(); - for (String s : connectionString.split(";")) { - String[] kvp = s.split("=", 2); - connectionKVPs.put(kvp[0].toLowerCase(), kvp[1]); - } - - String accountName = connectionKVPs.get(ACCOUNT_NAME); - String accountKey = connectionKVPs.get(ACCOUNT_KEY); - - if (ImplUtils.isNullOrEmpty(accountName) || ImplUtils.isNullOrEmpty(accountKey)) { - throw new IllegalArgumentException("Connection string must contain 'AccountName' and 'AccountKey'."); - } - - // Use accountName and accountKey to get the SAS token using the credential class. - credentials = new SharedKeyCredentials(accountName, accountKey); - - return this; - } - - /** - * Sets the http client used to send service requests - * @param httpClient http client to send requests - * @return the updated PageBlobClientBuilder object - */ - public PageBlobClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /** - * Adds a pipeline policy to apply on each request sent - * @param pipelinePolicy a pipeline policy - * @return the updated PageBlobClientBuilder object - */ - public PageBlobClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - this.policies.add(pipelinePolicy); - return this; - } - - /** - * Sets the logging level for service requests - * @param logLevel logging level - * @return the updated PageBlobClientBuilder object - */ - public PageBlobClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { - this.logLevel = logLevel; - return this; - } - - /** - * Sets the configuration object used to retrieve environment configuration values used to buildClient the client with - * when they are not set in the appendBlobClientBuilder, defaults to Configuration.NONE - * @param configuration configuration store - * @return the updated PageBlobClientBuilder object - */ - public PageBlobClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/PageBlobRawClient.java b/storage/client/src/main/java/com/azure/storage/blob/PageBlobRawClient.java deleted file mode 100644 index 1e26cfcd473a9..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/PageBlobRawClient.java +++ /dev/null @@ -1,579 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.BlobHTTPHeaders; -import com.azure.storage.blob.models.ModifiedAccessConditions; -import com.azure.storage.blob.models.PageBlobsClearPagesResponse; -import com.azure.storage.blob.models.PageBlobsCopyIncrementalResponse; -import com.azure.storage.blob.models.PageBlobsCreateResponse; -import com.azure.storage.blob.models.PageBlobsGetPageRangesDiffResponse; -import com.azure.storage.blob.models.PageBlobsGetPageRangesResponse; -import com.azure.storage.blob.models.PageBlobsResizeResponse; -import com.azure.storage.blob.models.PageBlobsUpdateSequenceNumberResponse; -import com.azure.storage.blob.models.PageBlobsUploadPagesFromURLResponse; -import com.azure.storage.blob.models.PageBlobsUploadPagesResponse; -import com.azure.storage.blob.models.PageRange; -import com.azure.storage.blob.models.SequenceNumberActionType; -import com.azure.storage.blob.models.SourceModifiedAccessConditions; -import io.netty.buffer.ByteBuf; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.net.URL; -import java.time.Duration; - -/** - * Represents a URL to a page blob. It may be obtained by direct construction or via the create method on a - * {@link ContainerAsyncClient} object. This class does not hold any state about a particular blob but is instead a convenient - * way of sending off appropriate requests to the resource on the service. Please refer to the - * Azure Docs - * for more information. - */ -final class PageBlobRawClient extends BlobRawClient { - - private PageBlobAsyncRawClient pageBlobAsyncRawClient; - - /** - * Indicates the number of bytes in a page. - */ - public static final int PAGE_BYTES = 512; - - /** - * Indicates the maximum number of bytes that may be sent in a call to putPage. - */ - public static final int MAX_PUT_PAGES_BYTES = 4 * Constants.MB; - - /** - * Creates a {@code PageBlobAsyncRawClient} object pointing to the account specified by the URL and using the provided - */ - public PageBlobRawClient(AzureBlobStorageImpl azureBlobStorage) { - super(azureBlobStorage); - this.pageBlobAsyncRawClient = new PageBlobAsyncRawClient(azureBlobStorage); - } - - // TODO: Figure out if this method needs to change to public to access method in wrappers - private static String pageRangeToString(PageRange pageRange) { - if (pageRange.start() < 0 || pageRange.end() <= 0) { - throw new IllegalArgumentException("PageRange's start and end values must be greater than or equal to " - + "0 if specified."); - } - if (pageRange.start() % PageBlobRawClient.PAGE_BYTES != 0) { - throw new IllegalArgumentException("PageRange's start value must be a multiple of 512."); - } - if (pageRange.end() % PageBlobRawClient.PAGE_BYTES != PageBlobRawClient.PAGE_BYTES - 1) { - throw new IllegalArgumentException("PageRange's end value must be 1 less than a multiple of 512."); - } - if (pageRange.end() <= pageRange.start()) { - throw new IllegalArgumentException("PageRange's End value must be after the start."); - } - return new StringBuilder("bytes=").append(pageRange.start()).append('-').append(pageRange.end()).toString(); - } - - /** - * Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. - * For more information, see the - * Azure Docs. - * - * @param size - * Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a - * 512-byte boundary. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.create")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public PageBlobsCreateResponse create(long size) { - return this.create(size, null, null, null, null, null, null); - } - - /** - * Creates a page blob of the specified length. Call PutPage to upload data data to a page blob. - * For more information, see the - * Azure Docs. - * - * @param size - * Specifies the maximum size for the page blob, up to 8 TB. The page blob size must be aligned to a - * 512-byte boundary. - * @param sequenceNumber - * A user-controlled value that you can use to track requests. The value of the sequence number must be - * between 0 and 2^63 - 1.The default value is 0. - * @param headers - * {@link BlobHTTPHeaders} - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.create")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public PageBlobsCreateResponse create(long size, Long sequenceNumber, BlobHTTPHeaders headers, - Metadata metadata, BlobAccessConditions accessConditions, Duration timeout, Context context) { - Mono response = pageBlobAsyncRawClient.create(size, sequenceNumber, headers, metadata, accessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } - - /** - * Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512. - * For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset must - * be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges are - * 0-511, 512-1023, etc. - * @param body - * The data to upload. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.uploadPages")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public PageBlobsUploadPagesResponse uploadPages(PageRange pageRange, Flux body) { - return this.uploadPages(pageRange, body, null, null, null); - } - - /** - * Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512. - * For more information, see the - * Azure Docs. - *

- * Note that the data passed must be replayable if retries are enabled (the default). In other words, the - * {@code Flux} must produce the same data each time it is subscribed to. - * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * @param body - * The data to upload. Note that this {@code Flux} must be replayable if retries are enabled - * (the default). In other words, the Flowable must produce the same data each time it is subscribed to. - * @param pageBlobAccessConditions - * {@link PageBlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.uploadPages")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public PageBlobsUploadPagesResponse uploadPages(PageRange pageRange, Flux body, - PageBlobAccessConditions pageBlobAccessConditions, Duration timeout, Context context) { - Mono response = pageBlobAsyncRawClient.uploadPages(pageRange, body, pageBlobAccessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } - - /** - * Writes 1 or more pages from the source page blob to this page blob. The start and end offsets must be a multiple - * of 512. - * For more information, see the - * Azure Docs. - *

- * - * @param range - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceOffset - * The source offset to copy from. Pass null or 0 to copy from the beginning of source page blob. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_from_url "Sample code for PageBlobAsyncRawClient.uploadPagesFromURL")] - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public PageBlobsUploadPagesFromURLResponse uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset) { - return this.uploadPagesFromURL(range, sourceURL, sourceOffset, null, null, - null, null, null); - } - - /** - * Writes 1 or more pages from the source page blob to this page blob. The start and end offsets must be a multiple - * of 512. - * For more information, see the - * Azure Docs. - *

- * - * @param range - * The destination {@link PageRange} range. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * @param sourceURL - * The url to the blob that will be the source of the copy. A source blob in the same storage account can be - * authenticated via Shared Key. However, if the source is a blob in another account, the source blob must - * either be public or must be authenticated via a shared access signature. If the source blob is public, no - * authentication is required to perform the operation. - * @param sourceOffset - * The source offset to copy from. Pass null or 0 to copy from the beginning of source blob. - * @param sourceContentMD5 - * An MD5 hash of the block content from the source blob. If specified, the service will calculate the MD5 - * of the received data and fail the request if it does not match the provided MD5. - * @param destAccessConditions - * {@link PageBlobAccessConditions} - * @param sourceAccessConditions - * {@link SourceModifiedAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_from_url "Sample code for PageBlobAsyncRawClient.uploadPagesFromURL")] - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public PageBlobsUploadPagesFromURLResponse uploadPagesFromURL(PageRange range, URL sourceURL, Long sourceOffset, - byte[] sourceContentMD5, PageBlobAccessConditions destAccessConditions, - SourceModifiedAccessConditions sourceAccessConditions, Duration timeout, Context context) { - - Mono response = pageBlobAsyncRawClient.uploadPagesFromURL(range, sourceURL, sourceOffset, sourceContentMD5, destAccessConditions, sourceAccessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } - - /** - * Frees the specified pages from the page blob. - * For more information, see the - * Azure Docs. - * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.clearPages")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public PageBlobsClearPagesResponse clearPages(PageRange pageRange) { - return this.clearPages(pageRange, null, null, null); - } - - /** - * Frees the specified pages from the page blob. - * For more information, see the - * Azure Docs. - * - * @param pageRange - * A {@link PageRange} object. Given that pages must be aligned with 512-byte boundaries, the start offset - * must be a modulus of 512 and the end offset must be a modulus of 512 - 1. Examples of valid byte ranges - * are 0-511, 512-1023, etc. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * @param pageBlobAccessConditions - * {@link PageBlobAccessConditions} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.clearPages")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public PageBlobsClearPagesResponse clearPages(PageRange pageRange, - PageBlobAccessConditions pageBlobAccessConditions, Duration timeout, Context context) { - Mono response = pageBlobAsyncRawClient.clearPages(pageRange, pageBlobAccessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } - - /** - * Returns the list of valid page ranges for a page blob or snapshot of a page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.getPageRanges")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public PageBlobsGetPageRangesResponse getPageRanges(BlobRange blobRange) { - return this.getPageRanges(blobRange, null, null, null); - } - - /** - * Returns the list of valid page ranges for a page blob or snapshot of a page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.getPageRanges")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public PageBlobsGetPageRangesResponse getPageRanges(BlobRange blobRange, - BlobAccessConditions accessConditions, Duration timeout, Context context) { - Mono response = pageBlobAsyncRawClient.getPageRanges(blobRange, accessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } - - /** - * Gets the collection of page ranges that differ between a specified snapshot and this page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * @param prevSnapshot - * Specifies that the response will contain only pages that were changed between target blob and previous - * snapshot. Changed pages include both updated and cleared pages. The target - * blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_diff "Sample code for PageBlobAsyncRawClient.getPageRangesDiff")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public PageBlobsGetPageRangesDiffResponse getPageRangesDiff(BlobRange blobRange, String prevSnapshot) { - return this.getPageRangesDiff(blobRange, prevSnapshot, null, null, null); - } - - /** - * Gets the collection of page ranges that differ between a specified snapshot and this page blob. - * For more information, see the Azure Docs. - * - * @param blobRange - * {@link BlobRange} - * @param prevSnapshot - * Specifies that the response will contain only pages that were changed between target blob and previous - * snapshot. Changed pages include both updated and cleared pages. The target - * blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_diff "Sample code for PageBlobAsyncRawClient.getPageRangesDiff")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public PageBlobsGetPageRangesDiffResponse getPageRangesDiff(BlobRange blobRange, String prevSnapshot, - BlobAccessConditions accessConditions, Duration timeout, Context context) { - Mono response =pageBlobAsyncRawClient.getPageRangesDiff(blobRange, prevSnapshot, accessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } - - /** - * Resizes the page blob to the specified size (which must be a multiple of 512). - * For more information, see the Azure Docs. - * - * @param size - * Resizes a page blob to the specified size. If the specified value is less than the current size of the - * blob, then all pages above the specified value are cleared. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.resize")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public PageBlobsResizeResponse resize(long size) { - return this.resize(size, null, null, null); - } - - /** - * Resizes the page blob to the specified size (which must be a multiple of 512). - * For more information, see the Azure Docs. - * - * @param size - * Resizes a page blob to the specified size. If the specified value is less than the current size of the - * blob, then all pages above the specified value are cleared. - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.resize")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public PageBlobsResizeResponse resize(long size, BlobAccessConditions accessConditions, Duration timeout, Context context) { - Mono response = pageBlobAsyncRawClient.resize(size, accessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } - - /** - * Sets the page blob's sequence number. - * For more information, see the Azure Docs. - * - * @param action - * Indicates how the service should modify the blob's sequence number. - * @param sequenceNumber - * The blob's sequence number. The sequence number is a user-controlled property that you can use to track - * requests and manage concurrency issues. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.updateSequenceNumber")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public PageBlobsUpdateSequenceNumberResponse updateSequenceNumber(SequenceNumberActionType action, - Long sequenceNumber) { - return this.updateSequenceNumber(action, sequenceNumber, null, null, null); - } - - /** - * Sets the page blob's sequence number. - * For more information, see the Azure Docs. - * - * @param action - * Indicates how the service should modify the blob's sequence number. - * @param sequenceNumber - * The blob's sequence number. The sequence number is a user-controlled property that you can use to track - * requests and manage concurrency issues. - * @param accessConditions - * {@link BlobAccessConditions} - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=page_blob_basic "Sample code for PageBlobAsyncRawClient.updateSequenceNumber")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public PageBlobsUpdateSequenceNumberResponse updateSequenceNumber(SequenceNumberActionType action, - Long sequenceNumber, BlobAccessConditions accessConditions, Duration timeout, Context context) { - Mono response = pageBlobAsyncRawClient.updateSequenceNumber(action, sequenceNumber, accessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } - - /** - * Begins an operation to start an incremental copy from one page blob's snapshot to this page - * blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are - * transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read - * or copied from as usual. For more information, see - * the Azure Docs here and - * here. - * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. - * - * @return Emits the successful response. - */ - public PageBlobsCopyIncrementalResponse copyIncremental(URL source, String snapshot) { - return this.copyIncremental(source, snapshot, null, null, null); - } - - /** - * Begins an operation to start an incremental copy from one page blob's snapshot to this page - * blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are - * transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read - * or copied from as usual. For more information, see - * the Azure Docs here and - * here. - * - * @param source - * The source page blob. - * @param snapshot - * The snapshot on the copy source. - * @param modifiedAccessConditions - * Standard HTTP Access conditions related to the modification of data. ETag and LastModifiedTime are used - * to construct conditions related to when the blob was changed relative to the given request. The request - * will fail if the specified condition is not satisfied. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to its - * parent, forming a linked list. - * - * @return Emits the successful response. - */ - public PageBlobsCopyIncrementalResponse copyIncremental(URL source, String snapshot, - ModifiedAccessConditions modifiedAccessConditions, Duration timeout, Context context) { - Mono response = pageBlobAsyncRawClient.copyIncremental(source, snapshot, modifiedAccessConditions, context); - return timeout == null? - response.block(): - response.block(timeout); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/PipelineOptions.java b/storage/client/src/main/java/com/azure/storage/blob/PipelineOptions.java deleted file mode 100644 index 89b7d56933abe..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/PipelineOptions.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpClient; - -/** - * This type encapsulates all the possible configuration for the default pipeline. It may be passed to the - * createPipeline method on {@link StorageURL}. All the options fields have default values if nothing is passed, and - * no logger will be used if it is not set. An HttpClient must be set, however. - */ -public final class PipelineOptions { - /* - PipelineOptions is mutable, but its fields refer to immutable objects. The createPipeline method can pass the - fields to other methods, but the PipelineOptions object itself can only be used for the duration of this call; it - must not be passed to anything with a longer lifetime. - */ - - private HttpClient client; - - private RequestRetryOptions requestRetryOptions = new RequestRetryOptions(); - - private LoggingOptions loggingOptions = new LoggingOptions(); - - private TelemetryOptions telemetryOptions = new TelemetryOptions(); - - - /** - * Specifies which HttpClient to use to send the requests. - */ - public HttpClient client() { - return client; - } - - /** - * Specifies which HttpClient to use to send the requests. - */ - public PipelineOptions withClient(HttpClient client) { - this.client = client; - return this; - } - - /** - * Configures the retry policy's behavior. - */ - public RequestRetryOptions requestRetryOptions() { - return requestRetryOptions; - } - - /** - * Configures the retry policy's behavior. - */ - public PipelineOptions withRequestRetryOptions(RequestRetryOptions requestRetryOptions) { - this.requestRetryOptions = requestRetryOptions; - return this; - } - - /** - * Configures the built-in request logging policy. - */ - public LoggingOptions loggingOptions() { - return loggingOptions; - } - - /** - * Configures the built-in request logging policy. - */ - public PipelineOptions withLoggingOptions(LoggingOptions loggingOptions) { - this.loggingOptions = loggingOptions; - return this; - } - - /** - * Configures the built-in telemetry policy behavior. - */ - public TelemetryOptions telemetryOptions() { - return telemetryOptions; - } - - /** - * Configures the built-in telemetry policy behavior. - */ - public PipelineOptions withTelemetryOptions(TelemetryOptions telemetryOptions) { - this.telemetryOptions = telemetryOptions; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/ProgressReporter.java b/storage/client/src/main/java/com/azure/storage/blob/ProgressReporter.java deleted file mode 100644 index fc882d4c30aa4..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/ProgressReporter.java +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.nio.ByteBuffer; -import java.util.concurrent.atomic.AtomicLong; -import java.util.concurrent.locks.Lock; - -/** - * {@code ProgressReporterImpl} offers a convenient way to add progress tracking to a given Flowable. - */ -final class ProgressReporter { - - private abstract static class ProgressReporterImpl implements IProgressReceiver { - long blockProgress; - - final IProgressReceiver progressReceiver; - - ProgressReporterImpl(IProgressReceiver progressReceiver) { - this.blockProgress = 0; - this.progressReceiver = progressReceiver; - } - - @Override - public void reportProgress(long bytesTransferred) { - this.blockProgress += bytesTransferred; - } - - void rewindProgress() { - this.blockProgress = 0; - } - - Flux addProgressReporting(Flux data) { - return Mono.just(this) - .flatMapMany(progressReporter -> { - /* - Each time there is a new subscription, we will rewind the progress. This is desirable specifically - for retries, which resubscribe on each try. The first time this flowable is subscribed to, the - rewind will be a noop as there will have been no progress made. Subsequent rewinds will work as - expected. - */ - progressReporter.rewindProgress(); - /* - Every time we emit some data, report it to the Tracker, which will pass it on to the end user. - */ - return data.doOnNext(buffer -> - progressReporter.reportProgress(buffer.remaining())); - }); - } - } - - /** - * This type is used to keep track of the total amount of data transferred for a single request. This is the type - * we will use when the customer uses the factory to add progress reporting to their Flowable. We need this - * additional type because we can't keep local state directly as lambdas require captured local variables to be - * effectively final. - */ - private static class SequentialProgressReporter extends ProgressReporterImpl { - SequentialProgressReporter(IProgressReceiver progressReceiver) { - super(progressReceiver); - } - - @Override - public void reportProgress(long bytesTransferred) { - super.reportProgress(bytesTransferred); - this.progressReceiver.reportProgress(this.blockProgress); - } - } - - /** - * This type is used to keep track of the total amount of data transferred as a part of a parallel upload in order - * to coordinate progress reporting to the end user. We need this additional type because we can't keep local state - * directly as lambdas require captured local variables to be effectively final. - */ - private static class ParallelProgressReporter extends ProgressReporterImpl { - /* - This lock will be instantiated by the operation initiating the whole transfer to coordinate each - ProgressReporterImpl. - */ - private final Lock transferLock; - - /* - We need an AtomicLong to be able to update the value referenced. Because we are already synchronizing with the - lock, we don't incur any additional performance hit here by the synchronization. - */ - private AtomicLong totalProgress; - - ParallelProgressReporter(IProgressReceiver progressReceiver, Lock lock, AtomicLong totalProgress) { - super(progressReceiver); - this.transferLock = lock; - this.totalProgress = totalProgress; - } - - @Override - public void reportProgress(long bytesTransferred) { - super.reportProgress(bytesTransferred); - - /* - It is typically a bad idea to lock around customer code (which the progressReceiver is) because they could - never release the lock. However, we have decided that it is sufficiently difficult for them to make their - progressReporting code threadsafe that we will take that burden and the ensuing risks. Although it is the - case that only one thread is allowed to be in onNext at once, however there are multiple independent - requests happening at once to stage/download separate chunks, so we still need to lock either way. - */ - transferLock.lock(); - this.progressReceiver.reportProgress(this.totalProgress.addAndGet(bytesTransferred)); - transferLock.unlock(); - } - - /* - This is used in the case of retries to rewind the amount of progress reported so as not to over-report at the - end. - */ - @Override - public void rewindProgress() { - /* - Blocks do not interfere with each other's block progress and there is no way that, for a single block, one - thread will be trying to add to the progress while the other is trying to zero it. The updates are strictly - sequential. Avoiding using the lock is ideal. - */ - this.totalProgress.addAndGet(-1 * this.blockProgress); - super.rewindProgress(); - } - - } - - /** - * Adds progress reporting functionality to the given {@code Flux}. Each subscription (and therefore each - * retry) will rewind the progress reported so as not to over-report. The data reported will be the total amount - * of data emitted so far, or the "current position" of the Flowable. - * - * @param data - * The data whose transfer progress is to be tracked. - * @param progressReceiver - * {@link IProgressReceiver} - * - * @return A {@code Flux} that emits the same data as the source but calls a callback to report the total amount - * of data emitted so far. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=progress "Sample code for ProgressReporterFactor.addProgressReporting")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public static Flux addProgressReporting(Flux data, - IProgressReceiver progressReceiver) { - if (progressReceiver == null) { - return data; - } else { - ProgressReporterImpl tracker = new SequentialProgressReporter(progressReceiver); - return tracker.addProgressReporting(data); - } - } - - static Flux addParallelProgressReporting(Flux data, - IProgressReceiver progressReceiver, Lock lock, AtomicLong totalProgress) { - if (progressReceiver == null) { - return data; - } else { - ParallelProgressReporter tracker = new ParallelProgressReporter(progressReceiver, lock, totalProgress); - return tracker.addProgressReporting(data); - } - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/ReliableDownloadOptions.java b/storage/client/src/main/java/com/azure/storage/blob/ReliableDownloadOptions.java deleted file mode 100644 index 1b816ad3547d7..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/ReliableDownloadOptions.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -/** - * {@code ReliableDownloadOptions} contains properties which help the {@code Flux} returned from - * {@link DownloadAsyncResponse#body(ReliableDownloadOptions)} determine when to retry. - */ -public final class ReliableDownloadOptions { - - /* - We use "retry" here because by the time the user passes this type, the initial request, or try, has already been - issued and returned. This is in contrast to the retry policy options, which includes the initial try in its count, - thus the difference in verbiage. - */ - private int maxRetryRequests = 0; - - /** - * Specifies the maximum number of additional HTTP Get requests that will be made while reading the data from a - * response body. - */ - public int maxRetryRequests() { - return maxRetryRequests; - } - - /** - * Specifies the maximum number of additional HTTP Get requests that will be made while reading the data from a - * response body. - */ - public ReliableDownloadOptions withMaxRetryRequests(int maxRetryRequests) { - Utility.assertInBounds("options.maxRetryRequests", maxRetryRequests, 0, Integer.MAX_VALUE); - this.maxRetryRequests = maxRetryRequests; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/RequestIDPolicy.java b/storage/client/src/main/java/com/azure/storage/blob/RequestIDPolicy.java deleted file mode 100644 index 87c3bf631b2a6..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/RequestIDPolicy.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipelineCallContext; -import com.azure.core.http.HttpPipelineNextPolicy; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.policy.HttpPipelinePolicy; -import reactor.core.publisher.Mono; - -import java.util.UUID; - -/** - * This is a factory which creates policies in an {@link com.azure.core.http.HttpPipeline} for setting a unique request ID in the - * x-ms-client-request-id header as is required for all requests to the service. In most cases, it is sufficient to - * allow the default pipeline to add this factory automatically and assume that it works. The factory and policy must - * only be used directly when creating a custom pipeline. - */ -final class RequestIDPolicy implements HttpPipelinePolicy { - - @Override - public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - context.httpRequest().headers().put(Constants.HeaderConstants.CLIENT_REQUEST_ID_HEADER, UUID.randomUUID().toString()); - return next.process(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/RequestRetryFactory.java b/storage/client/src/main/java/com/azure/storage/blob/RequestRetryFactory.java deleted file mode 100644 index 8fe35ef426228..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/RequestRetryFactory.java +++ /dev/null @@ -1,224 +0,0 @@ -//// Copyright (c) Microsoft Corporation. All rights reserved. -//// Licensed under the MIT License. -// -//package com.azure.storage.blob; -// -// -//import java.io.IOException; -//import java.net.MalformedURLException; -//import java.nio.ByteBuffer; -//import java.util.concurrent.ThreadLocalRandom; -//import java.util.concurrent.TimeUnit; -//import java.util.concurrent.TimeoutException; -// -///** -// * This is a factory which creates policies in an {@link HttpPipeline} for retrying a given HTTP request. The request -// * that is retried will be identical each time it is reissued. In most cases, it is sufficient to configure a {@link -// * RequestRetryOptions} object and set those as a field on a {@link PipelineOptions} object to configure a default -// * pipeline. Retries will try against a secondary if one is specified and the type of operation/error indicates that the -// * secondary can handle the request. Exponential and fixed backoff are supported. The factory and policy must only be -// * used directly when creating a custom pipeline. -// */ -//public final class RequestRetryFactory implements RequestPolicyFactory { -// -// private final RequestRetryOptions requestRetryOptions; -// -// /** -// * Creates a factory capable of generating RequestRetry policies for the {@link HttpPipeline}. -// * -// * @param requestRetryOptions -// * {@link RequestRetryOptions} -// */ -// public RequestRetryFactory(RequestRetryOptions requestRetryOptions) { -// this.requestRetryOptions = requestRetryOptions == null ? new RequestRetryOptions() : requestRetryOptions; -// } -// -// @Override -// public RequestPolicy create(RequestPolicy next, RequestPolicyOptions options) { -// return new RequestRetryPolicy(next, this.requestRetryOptions); -// } -// -// private static final class RequestRetryPolicy implements RequestPolicy { -// -// private final RequestPolicy nextPolicy; -// -// private final RequestRetryOptions requestRetryOptions; -// -// private RequestRetryPolicy(RequestPolicy nextPolicy, RequestRetryOptions requestRetryOptions) { -// this.nextPolicy = nextPolicy; -// this.requestRetryOptions = requestRetryOptions; -// } -// -// @Override -// public Single sendAsync(HttpRequest httpRequest) { -// boolean considerSecondary = (httpRequest.httpMethod().equals(HttpMethod.GET) -// || httpRequest.httpMethod().equals(HttpMethod.HEAD)) -// && (this.requestRetryOptions.secondaryHost() != null); -// -// return this.attemptAsync(httpRequest, 1, considerSecondary, 1); -// } -// -// // This is to log for debugging purposes only. Comment/uncomment as necessary for releasing/debugging. -// private void logf(String s, Object... args) { -// //System.out.println(String.format(s, args)); -// } -// -// /** -// * This method actually attempts to send the request and determines if we should attempt again and, if so, how -// * long to wait before sending out the next request. -// *

-// * Exponential retry algorithm: ((2 ^ attempt) - 1) * delay * random(0.8, 1.2) When to retry: connection failure -// * or an HTTP status code of 500 or greater, except 501 and 505 If using a secondary: Odd tries go against -// * primary; even tries go against the secondary For a primary wait ((2 ^ primaryTries - 1) * delay * random(0.8, -// * 1.2) If secondary gets a 404, don't fail, retry but future retries are only against the primary When retrying -// * against a secondary, ignore the retry count and wait (.1 second * random(0.8, 1.2)) -// * -// * @param httpRequest -// * The request to try. -// * @param primaryTry -// * This indicates how man tries we've attempted against the primary DC. -// * @param considerSecondary -// * Before each try, we'll select either the primary or secondary URL if appropriate. -// * @param attempt -// * This indicates the total number of attempts to send the request. -// * -// * @return A single containing either the successful response or an error that was not retryable because either -// * the maxTries was exceeded or retries will not mitigate the issue. -// */ -// private Single attemptAsync(final HttpRequest httpRequest, final int primaryTry, -// final boolean considerSecondary, -// final int attempt) { -// logf("\n=====> Try=%d\n", attempt); -// -// // Determine which endpoint to try. It's primary if there is no secondary or if it is an odd number attempt. -// final boolean tryingPrimary = !considerSecondary || (attempt % 2 != 0); -// -// // Select the correct host and delay. -// long delayMs; -// if (tryingPrimary) { -// // The first attempt returns 0 delay. -// delayMs = this.requestRetryOptions.calculateDelayInMs(primaryTry); -// logf("Primary try=%d, Delay=%d\n", primaryTry, delayMs); -// } else { -// // Delay with some jitter before trying the secondary. -// delayMs = (long) ((ThreadLocalRandom.current().nextFloat() / 2 + 0.8) * 1000); // Add jitter -// logf("Secondary try=%d, Delay=%d\n", attempt - primaryTry, delayMs); -// } -// -// /* -// Clone the original request to ensure that each try starts with the original (unmutated) request. We cannot -// simply call httpRequest.buffer() because although the body will start emitting from the beginning of the -// stream, the buffers that were emitted will have already been consumed (their position set to their limit), -// so it is not a true reset. By adding the map function, we ensure that anything which consumes the -// ByteBuffers downstream will only actually consume a duplicate so the original is preserved. This only -// duplicates the ByteBuffer object, not the underlying data. -// */ -// HttpHeaders bufferedHeaders = new HttpHeaders(httpRequest.headers()); -// Flowable bufferedBody = httpRequest.body() == null -// ? null : httpRequest.body().map(ByteBuffer::duplicate); -// final HttpRequest requestCopy = new HttpRequest(httpRequest.callerMethod(), httpRequest.httpMethod(), -// httpRequest.url(), bufferedHeaders, bufferedBody, httpRequest.responseDecoder()); -// if (!tryingPrimary) { -// UrlBuilder builder = UrlBuilder.parse(requestCopy.url()); -// builder.withHost(this.requestRetryOptions.secondaryHost()); -// try { -// requestCopy.withUrl(builder.toURL()); -// } catch (MalformedURLException e) { -// return Single.error(e); -// } -// } -// requestCopy.withContext(httpRequest.context()); -// -// // Deadline stuff -// -// /* -// We want to send the request with a given timeout, but we don't want to kickoff that timeout-bound operation -// until after the retry backoff delay, so we call delaySubscription. -// */ -// return this.nextPolicy.sendAsync(requestCopy) -// .timeout(this.requestRetryOptions.tryTimeout(), TimeUnit.SECONDS) -// .delaySubscription(delayMs, TimeUnit.MILLISECONDS) -// .flatMap(response -> { -// boolean newConsiderSecondary = considerSecondary; -// String action; -// int statusCode = response.statusCode(); -// -// /* -// If attempt was against the secondary & it returned a StatusNotFound (404), then the -// resource was not found. This may be due to replication delay. So, in this case, -// we'll never try the secondary again for this operation. -// */ -// if (!tryingPrimary && statusCode == 404) { -// newConsiderSecondary = false; -// action = "Retry: Secondary URL returned 404"; -// } else if (statusCode == 503 || statusCode == 500) { -// action = "Retry: Temporary error or server timeout"; -// } else { -// action = "NoRetry: Successful HTTP request"; -// } -// -// logf("Action=%s\n", action); -// if (action.charAt(0) == 'R' && attempt < requestRetryOptions.maxTries()) { -// /* -// We increment primaryTry if we are about to try the primary again (which is when we -// consider the secondary and tried the secondary this time (tryingPrimary==false) or -// we do not consider the secondary at all (considerSecondary==false)). This will -// ensure primaryTry is correct when passed to calculate the delay. -// */ -// int newPrimaryTry = !tryingPrimary || !considerSecondary -// ? primaryTry + 1 : primaryTry; -// return attemptAsync(httpRequest, newPrimaryTry, newConsiderSecondary, -// attempt + 1); -// } -// return Single.just(response); -// }) -// .onErrorResumeNext(throwable -> { -// /* -// It is likely that many users will not realize that their Flowable must be replayable and -// get an error upon retries when the provided data length does not match the length of the exact -// data. We cannot enforce the desired Flowable behavior, so we provide a hint when this is likely -// the root cause. -// */ -// if (throwable instanceof UnexpectedLengthException && attempt > 1) { -// return Single.error(new IllegalStateException("The request failed because the " -// + "size of the contents of the provided Flowable did not match the provided " -// + "data size upon attempting to retry. This is likely caused by the Flowable " -// + "not being replayable. To support retries, all Flowables must produce the " -// + "same data for each subscriber. Please ensure this behavior.", throwable)); -// } -// -// /* -// IOException is a catch-all for IO related errors. Technically it includes many types which may -// not be network exceptions, but we should not hit those unless there is a bug in our logic. In -// either case, it is better to optimistically retry instead of failing too soon. -// A Timeout Exception is a client-side timeout coming from Rx. -// */ -// String action; -// if (throwable instanceof IOException) { -// action = "Retry: Network error"; -// } else if (throwable instanceof TimeoutException) { -// action = "Retry: Client timeout"; -// } else { -// action = "NoRetry: Unknown error"; -// } -// -// -// -// logf("Action=%s\n", action); -// if (action.charAt(0) == 'R' && attempt < requestRetryOptions.maxTries()) { -// /* -// We increment primaryTry if we are about to try the primary again (which is when we -// consider the secondary and tried the secondary this time (tryingPrimary==false) or -// we do not consider the secondary at all (considerSecondary==false)). This will -// ensure primaryTry is correct when passed to calculate the delay. -// */ -// int newPrimaryTry = !tryingPrimary || !considerSecondary -// ? primaryTry + 1 : primaryTry; -// return attemptAsync(httpRequest, newPrimaryTry, considerSecondary, -// attempt + 1); -// } -// return Single.error(throwable); -// }); -// } -// } -//} diff --git a/storage/client/src/main/java/com/azure/storage/blob/RequestRetryOptions.java b/storage/client/src/main/java/com/azure/storage/blob/RequestRetryOptions.java deleted file mode 100644 index 66219da36e836..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/RequestRetryOptions.java +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import java.util.concurrent.TimeUnit; - -/** - * Options for configuring the {@link RequestRetryPolicy}. Please refer to the Factory for more information. Note - * that there is no option for overall operation timeout. This is because Rx object have a timeout field which provides - * this functionality. - */ -final class RequestRetryOptions { - - private final int maxTries; - private final int tryTimeout; - private final long retryDelayInMs; - private final long maxRetryDelayInMs; - /** - * A {@link RetryPolicyType} telling the pipeline what kind of retry policy to use. - */ - private RetryPolicyType retryPolicyType; - private String secondaryHost; - - /** - * Constructor with default retry values: Exponential backoff, maxTries=4, tryTimeout=30, retryDelayInMs=4000, - * maxRetryDelayInMs=120000, secondaryHost=null. - */ - public RequestRetryOptions() { - this(RetryPolicyType.EXPONENTIAL, null, - null, null, null, null); - } - - /** - * Configures how the {@link com.microsoft.rest.v2.http.HttpPipeline} should retry requests. - * - * @param retryPolicyType - * A {@link RetryPolicyType} specifying the type of retry pattern to use. A value of {@code null} accepts - * the default. - * @param maxTries - * Specifies the maximum number of attempts an operation will be tried before producing an error. A value of - * {@code null} means that you accept our default policy. A value of 1 means 1 try and no retries. - * @param tryTimeout - * Indicates the maximum time allowed for any single try of an HTTP request. A value of {@code null} means - * that you accept our default. NOTE: When transferring large amounts of data, the default TryTimeout will - * probably not be sufficient. You should override this value based on the bandwidth available to the host - * machine and proximity to the Storage service. A good starting point may be something like (60 seconds per - * MB of anticipated-payload-size). - * @param retryDelayInMs - * Specifies the amount of delay to use before retrying an operation. A value of {@code null} means you - * accept the default value. The delay increases (exponentially or linearly) with each retry up to a maximum - * specified by MaxRetryDelay. If you specify {@code null}, then you must also specify {@code null} for - * MaxRetryDelay. - * @param maxRetryDelayInMs - * Specifies the maximum delay allowed before retrying an operation. A value of {@code null} means you - * accept the default value. If you specify {@code null}, then you must also specify {@code null} for - * RetryDelay. - * @param secondaryHost - * If a secondaryHost is specified, retries will be tried against this host. If secondaryHost is - * {@code null} (the default) then operations are not retried against another host. NOTE: Before setting - * this field, make sure you understand the issues around reading stale and potentially-inconsistent data at - * this webpage - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=pipeline_options "Sample code for RequestRetryOptions constructor")] \n - * For more samples, please see the [Samples file] (https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public RequestRetryOptions(RetryPolicyType retryPolicyType, Integer maxTries, Integer tryTimeout, - Long retryDelayInMs, Long maxRetryDelayInMs, String secondaryHost) { - this.retryPolicyType = retryPolicyType == null ? RetryPolicyType.EXPONENTIAL : retryPolicyType; - if (maxTries != null) { - Utility.assertInBounds("maxRetries", maxTries, 1, Integer.MAX_VALUE); - this.maxTries = maxTries; - } else { - this.maxTries = 4; - } - - if (tryTimeout != null) { - Utility.assertInBounds("tryTimeout", tryTimeout, 1, Integer.MAX_VALUE); - this.tryTimeout = tryTimeout; - } else { - this.tryTimeout = 60; - } - - if ((retryDelayInMs == null && maxRetryDelayInMs != null) - || (retryDelayInMs != null && maxRetryDelayInMs == null)) { - throw new IllegalArgumentException("Both retryDelay and maxRetryDelay must be null or neither can be null"); - } - - if (retryDelayInMs != null && maxRetryDelayInMs != null) { - Utility.assertInBounds("maxRetryDelayInMs", maxRetryDelayInMs, 1, Long.MAX_VALUE); - Utility.assertInBounds("retryDelayInMs", retryDelayInMs, 1, maxRetryDelayInMs); - this.maxRetryDelayInMs = maxRetryDelayInMs; - this.retryDelayInMs = retryDelayInMs; - } else { - switch (this.retryPolicyType) { - case EXPONENTIAL: - this.retryDelayInMs = TimeUnit.SECONDS.toMillis(4); - break; - case FIXED: - this.retryDelayInMs = TimeUnit.SECONDS.toMillis(30); - break; - default: - throw new IllegalArgumentException("Unrecognize retry policy type."); - } - this.maxRetryDelayInMs = TimeUnit.SECONDS.toMillis(120); - } - - this.secondaryHost = secondaryHost; - } - - int maxTries() { - return this.maxTries; - } - - int tryTimeout() { - return this.tryTimeout; - } - - String secondaryHost() { - return this.secondaryHost; - } - - long retryDelayInMs() { - return retryDelayInMs; - } - - long maxRetryDelayInMs() { - return maxRetryDelayInMs; - } - - /** - * Calculates how long to delay before sending the next request. - * - * @param tryCount - * An {@code int} indicating which try we are on. - * - * @return A {@code long} value of how many milliseconds to delay. - */ - long calculateDelayInMs(int tryCount) { - long delay = 0; - switch (this.retryPolicyType) { - case EXPONENTIAL: - delay = (pow(2L, tryCount - 1) - 1L) * this.retryDelayInMs; - break; - - case FIXED: - delay = this.retryDelayInMs; - break; - default: - throw new IllegalArgumentException("Invalid retry policy type."); - } - - return Math.min(delay, this.maxRetryDelayInMs); - } - - private long pow(long number, int exponent) { - long result = 1; - for (int i = 0; i < exponent; i++) { - result *= number; - } - - return result; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/RetryPolicyType.java b/storage/client/src/main/java/com/azure/storage/blob/RetryPolicyType.java deleted file mode 100644 index e91fb8f7f7176..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/RetryPolicyType.java +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -/** - * This type holds possible options for retry backoff algorithms. They may be used with {@link RequestRetryOptions}. - */ -enum RetryPolicyType { - /** - * Tells the pipeline to use an exponential back-off retry policy. - */ - EXPONENTIAL, - - /** - * Tells the pipeline to use a fixed back-off retry policy. - */ - FIXED -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/SASProtocol.java b/storage/client/src/main/java/com/azure/storage/blob/SASProtocol.java deleted file mode 100644 index 86ca4d94da4cc..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/SASProtocol.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import java.util.Locale; - -/** - * Specifies the set of possible permissions for a shared access signature protocol. Values of this type can be used - * to set the fields on the {@link AccountSASSignatureValues} and {@link ServiceSASSignatureValues} types. - */ -enum SASProtocol { - /** - * Permission to use SAS only through https granted. - */ - HTTPS_ONLY(Constants.HTTPS), - - /** - * Permission to use SAS only through https or http granted. - */ - HTTPS_HTTP(Constants.HTTPS_HTTP); - - private final String protocols; - - SASProtocol(String p) { - this.protocols = p; - } - - /** - * Parses a {@code String} into a {@code SASProtocl} value if possible. - * - * @param str - * The value to try to parse. - * - * @return A {@code SASProtocol} value that represents the string if possible. - */ - public static SASProtocol parse(String str) { - if (str.equals(Constants.HTTPS)) { - return SASProtocol.HTTPS_ONLY; - } else if (str.equals(Constants.HTTPS_HTTP)) { - return SASProtocol.HTTPS_HTTP; - } - throw new IllegalArgumentException(String.format(Locale.ROOT, - "%s could not be parsed into a SASProtocl value.", str)); - } - - @Override - public String toString() { - return this.protocols; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/SASQueryParameters.java b/storage/client/src/main/java/com/azure/storage/blob/SASQueryParameters.java deleted file mode 100644 index 25748c73c507c..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/SASQueryParameters.java +++ /dev/null @@ -1,641 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.storage.blob.models.UserDelegationKey; - -import java.net.UnknownHostException; -import java.time.OffsetDateTime; -import java.util.Map; - -import static com.azure.storage.blob.Utility.safeURLEncode; - -/** - * Represents the components that make up an Azure Storage SAS' query parameters. This type is not constructed directly - * by the user; it is only generated by the {@link AccountSASSignatureValues} and {@link ServiceSASSignatureValues} - * types. Once generated, it can be set on a {@link BlobURLParts} object to be constructed as part of a URL or it can - * be encoded into a {@code String} and appended to a URL directly (though caution should be taken here in case there - * are existing query parameters, which might affect the appropriate means of appending these query parameters). - * NOTE: Instances of this class are immutable to ensure thread safety. - */ -final class SASQueryParameters { - - private final String version; - - private final String services; - - private final String resourceTypes; - - private final SASProtocol protocol; - - private final OffsetDateTime startTime; - - private final OffsetDateTime expiryTime; - - private final IPRange ipRange; - - private final String identifier; - - private final String keyOid; - - private final String keyTid; - - private final OffsetDateTime keyStart; - - private final OffsetDateTime keyExpiry; - - private final String keyService; - - private final String keyVersion; - - private final String resource; - - private final String permissions; - - private final String signature; - - private final String cacheControl; - - private final String contentDisposition; - - private final String contentEncoding; - - private final String contentLanguage; - - private final String contentType; - - /** - * Creates a new {@link SASQueryParameters} object. - * - * @param queryParamsMap - * All query parameters for the request as key-value pairs - * @param removeSASParametersFromMap - * When {@code true}, the SAS query parameters will be removed from queryParamsMap - */ - SASQueryParameters(Map queryParamsMap, boolean removeSASParametersFromMap) - throws UnknownHostException { - - String[] queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_SERVICE_VERSION); - if (queryValue != null) { - this.version = queryValue[0]; - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_SERVICE_VERSION); - } - } else { - this.version = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_SERVICES); - if (queryValue != null) { - this.services = queryValue[0]; - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_SERVICES); - } - } else { - this.services = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_RESOURCES_TYPES); - if (queryValue != null) { - this.resourceTypes = queryValue[0]; - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_RESOURCES_TYPES); - } - } else { - this.resourceTypes = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_PROTOCOL); - if (queryValue != null) { - this.protocol = SASProtocol.parse(queryValue[0]); - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_PROTOCOL); - } - } else { - this.protocol = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_START_TIME); - if (queryValue != null) { - this.startTime = Utility.parseDate(queryValue[0]); - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_START_TIME); - } - } else { - this.startTime = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_EXPIRY_TIME); - if (queryValue != null) { - this.expiryTime = Utility.parseDate(queryValue[0]); - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_EXPIRY_TIME); - } - } else { - this.expiryTime = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_IP_RANGE); - if (queryValue != null) { - this.ipRange = IPRange.parse(queryValue[0]); - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_IP_RANGE); - } - } else { - this.ipRange = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_SIGNED_IDENTIFIER); - if (queryValue != null) { - this.identifier = queryValue[0]; - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_SIGNED_IDENTIFIER); - } - } else { - this.identifier = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_SIGNED_OBJECT_ID); - if (queryValue != null) { - this.keyOid = queryValue[0]; - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_SIGNED_OBJECT_ID); - } - } else { - this.keyOid = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_SIGNED_TENANT_ID); - if (queryValue != null) { - this.keyTid = queryValue[0]; - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_SIGNED_TENANT_ID); - } - } else { - this.keyTid = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_SIGNED_KEY_START); - if (queryValue != null) { - this.keyStart = Utility.parseDate(queryValue[0]); - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_SIGNED_KEY_START); - } - } else { - this.keyStart = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_SIGNED_KEY_EXPIRY); - if (queryValue != null) { - this.keyExpiry = Utility.parseDate(queryValue[0]); - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_SIGNED_KEY_EXPIRY); - } - } else { - this.keyExpiry = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_SIGNED_KEY_SERVICE); - if (queryValue != null) { - this.keyService = queryValue[0]; - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_SIGNED_KEY_SERVICE); - } - } else { - this.keyService = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_SIGNED_KEY_VERSION); - if (queryValue != null) { - this.keyVersion = queryValue[0]; - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_SIGNED_KEY_VERSION); - } - } else { - this.keyVersion = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_SIGNED_RESOURCE); - if (queryValue != null) { - this.resource = queryValue[0]; - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_SIGNED_RESOURCE); - } - } else { - this.resource = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_SIGNED_PERMISSIONS); - if (queryValue != null) { - this.permissions = queryValue[0]; - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_SIGNED_PERMISSIONS); - } - } else { - this.permissions = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_SIGNATURE); - if (queryValue != null) { - this.signature = queryValue[0]; - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_SIGNATURE); - } - } else { - this.signature = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_CACHE_CONTROL); - if (queryValue != null) { - this.cacheControl = queryValue[0]; - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_CACHE_CONTROL); - } - } else { - this.cacheControl = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_CONTENT_DISPOSITION); - if (queryValue != null) { - this.contentDisposition = queryValue[0]; - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_CONTENT_DISPOSITION); - } - } else { - this.contentDisposition = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_CONTENT_ENCODING); - if (queryValue != null) { - this.contentEncoding = queryValue[0]; - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_CONTENT_ENCODING); - } - } else { - this.contentEncoding = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_CONTENT_LANGUAGE); - if (queryValue != null) { - this.contentLanguage = queryValue[0]; - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_CONTENT_LANGUAGE); - } - } else { - this.contentLanguage = null; - } - - queryValue = queryParamsMap.get(Constants.UrlConstants.SAS_CONTENT_TYPE); - if (queryValue != null) { - this.contentType = queryValue[0]; - if (removeSASParametersFromMap) { - queryParamsMap.remove(Constants.UrlConstants.SAS_CONTENT_TYPE); - } - } else { - this.contentType = null; - } - } - - /** - * Creates a new {@link SASQueryParameters} object. These objects are only created internally by - * *SASSignatureValues classes. - * - * @param version - * A {@code String} representing the storage version. - * @param services - * A {@code String} representing the storage services being accessed (only for Account SAS). - * @param resourceTypes - * A {@code String} representing the storage resource types being accessed (only for Account SAS). - * @param protocol - * A {@code String} representing the allowed HTTP protocol(s) or {@code null}. - * @param startTime - * A {@code java.util.Date} representing the start time for this SAS token or {@code null}. - * @param expiryTime - * A {@code java.util.Date} representing the expiry time for this SAS token. - * @param ipRange - * A {@link IPRange} representing the range of valid IP addresses for this SAS token or {@code null}. - * @param identifier - * A {@code String} representing the signed identifier (only for Service SAS) or {@code null}. - * @param resource - * A {@code String} representing the storage container or blob (only for Service SAS). - * @param permissions - * A {@code String} representing the storage permissions or {@code null}. - * @param signature - * A {@code String} representing the signature for the SAS token. - */ - SASQueryParameters(String version, String services, String resourceTypes, SASProtocol protocol, - OffsetDateTime startTime, OffsetDateTime expiryTime, IPRange ipRange, String identifier, - String resource, String permissions, String signature, String cacheControl, String contentDisposition, - String contentEncoding, String contentLanguage, String contentType, UserDelegationKey key) { - - this.version = version; - this.services = services; - this.resourceTypes = resourceTypes; - this.protocol = protocol; - this.startTime = startTime; - this.expiryTime = expiryTime; - this.ipRange = ipRange; - this.identifier = identifier; - this.resource = resource; - this.permissions = permissions; - this.signature = signature; - this.cacheControl = cacheControl; - this.contentDisposition = contentDisposition; - this.contentEncoding = contentEncoding; - this.contentLanguage = contentLanguage; - this.contentType = contentType; - - if (key != null) { - this.keyOid = key.signedOid(); - this.keyTid = key.signedTid(); - this.keyStart = key.signedStart(); - this.keyExpiry = key.signedExpiry(); - this.keyService = key.signedService(); - this.keyVersion = key.signedVersion(); - } else { - this.keyOid = null; - this.keyTid = null; - this.keyStart = null; - this.keyExpiry = null; - this.keyService = null; - this.keyVersion = null; - } - } - - /** - * @return The storage version - */ - public String version() { - return version; - } - - /** - * @return The storage services being accessed (only for Account SAS). Please refer to {@link AccountSASService} for - * more details. - */ - public String services() { - return services; - } - - /** - * @return The storage resource types being accessed (only for Account SAS). Please refer to - * {@link AccountSASResourceType} for more details. - */ - public String resourceTypes() { - return resourceTypes; - } - - /** - * @return The allowed HTTP protocol(s) or {@code null}. Please refer to {@link SASProtocol} for more details. - */ - public SASProtocol protocol() { - return protocol; - } - - /** - * @return The start time for this SAS token or {@code null}. - */ - public OffsetDateTime startTime() { - return startTime; - } - - /** - * @return The expiry time for this SAS token. - */ - public OffsetDateTime expiryTime() { - return expiryTime; - } - - /** - * @return {@link IPRange} - */ - public IPRange ipRange() { - return ipRange; - } - - /** - * @return The signed identifier (only for {@link ServiceSASSignatureValues}) or {@code null}. Please see - * here - * for more information. - */ - public String identifier() { - return identifier; - } - - /** - * @return The storage container or blob (only for {@link ServiceSASSignatureValues}). - */ - public String resource() { - return resource; - } - - /** - * @return Please refer to {@link AccountSASPermission}, {@link BlobSASPermission}, or {@link ContainerSASPermission} - * for more details. - */ - public String permissions() { - return permissions; - } - - /** - * @return The signature for the SAS token. - */ - public String signature() { - return signature; - } - - /** - * @return The Cache-Control header value when a client accesses the resource with this sas token. - */ - public String cacheControl() { - return cacheControl; - } - - /** - * @return The Content-Disposition header value when a client accesses the resource with this sas token. - */ - public String contentDisposition() { - return contentDisposition; - } - - /** - * @return The Content-Encoding header value when a client accesses the resource with this sas token. - */ - public String contentEncoding() { - return contentEncoding; - } - - /** - * @return The Content-Language header value when a client accesses the resource with this sas token. - */ - public String contentLanguage() { - return contentLanguage; - } - - /** - * @return The Content-Type header value when a client accesses the resource with this sas token. - */ - public String contentType() { - return contentType; - } - - public String keyOid() { - return keyOid; - } - - public String keyTid() { - return keyTid; - } - - public OffsetDateTime keyStart() { - return keyStart; - } - - public OffsetDateTime keyExpiry() { - return keyExpiry; - } - - public String keyService() { - return keyService; - } - - public String keyVersion() { - return keyVersion; - } - - UserDelegationKey userDelegationKey() { - return new UserDelegationKey() - .signedExpiry(this.keyExpiry) - .signedOid(this.keyOid) - .signedService(this.keyService) - .signedStart(this.keyStart) - .signedTid(this.keyTid) - .signedVersion(this.keyVersion); - } - - private void tryAppendQueryParameter(StringBuilder sb, String param, Object value) { - if (value != null) { - if (sb.length() == 0) { - sb.append('?'); - } else { - sb.append('&'); - } - sb.append(safeURLEncode(param)).append('=').append(safeURLEncode(value.toString())); - } - } - - /** - * Encodes all SAS query parameters into a string that can be appended to a URL. - * - * @return A {@code String} representing all SAS query parameters. - */ - public String encode() { - /* - We should be url-encoding each key and each value, but because we know all the keys and values will encode to - themselves, we cheat except for the signature value. - */ - String[] params = { - Constants.UrlConstants.SAS_SERVICE_VERSION, - Constants.UrlConstants.SAS_SERVICES, - Constants.UrlConstants.SAS_RESOURCES_TYPES, - Constants.UrlConstants.SAS_PROTOCOL, - Constants.UrlConstants.SAS_START_TIME, - Constants.UrlConstants.SAS_EXPIRY_TIME, - Constants.UrlConstants.SAS_IP_RANGE, - Constants.UrlConstants.SAS_SIGNED_IDENTIFIER, - Constants.UrlConstants.SAS_SIGNED_OBJECT_ID, - Constants.UrlConstants.SAS_SIGNED_TENANT_ID, - Constants.UrlConstants.SAS_SIGNED_KEY_START, - Constants.UrlConstants.SAS_SIGNED_KEY_EXPIRY, - Constants.UrlConstants.SAS_SIGNED_KEY_SERVICE, - Constants.UrlConstants.SAS_SIGNED_KEY_VERSION, - Constants.UrlConstants.SAS_SIGNED_RESOURCE, - Constants.UrlConstants.SAS_SIGNED_PERMISSIONS, - Constants.UrlConstants.SAS_SIGNATURE, - Constants.UrlConstants.SAS_CACHE_CONTROL, - Constants.UrlConstants.SAS_CONTENT_DISPOSITION, - Constants.UrlConstants.SAS_CONTENT_ENCODING, - Constants.UrlConstants.SAS_CONTENT_LANGUAGE, - Constants.UrlConstants.SAS_CONTENT_TYPE - }; - StringBuilder sb = new StringBuilder(); - for (String param : params) { - switch (param) { - case Constants.UrlConstants.SAS_SERVICE_VERSION: - tryAppendQueryParameter(sb, param, this.version); - break; - case Constants.UrlConstants.SAS_SERVICES: - tryAppendQueryParameter(sb, param, this.services); - break; - case Constants.UrlConstants.SAS_RESOURCES_TYPES: - tryAppendQueryParameter(sb, param, this.resourceTypes); - break; - case Constants.UrlConstants.SAS_PROTOCOL: - tryAppendQueryParameter(sb, param, this.protocol); - break; - case Constants.UrlConstants.SAS_START_TIME: - tryAppendQueryParameter(sb, param, - this.startTime == null ? null : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.startTime)); - break; - case Constants.UrlConstants.SAS_EXPIRY_TIME: - tryAppendQueryParameter(sb, param, - this.expiryTime == null ? null : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.expiryTime)); - break; - case Constants.UrlConstants.SAS_IP_RANGE: - tryAppendQueryParameter(sb, param, this.ipRange); - break; - case Constants.UrlConstants.SAS_SIGNED_IDENTIFIER: - tryAppendQueryParameter(sb, param, this.identifier); - break; - case Constants.UrlConstants.SAS_SIGNED_OBJECT_ID: - tryAppendQueryParameter(sb, param, this.keyOid); - break; - case Constants.UrlConstants.SAS_SIGNED_TENANT_ID: - tryAppendQueryParameter(sb, param, this.keyTid); - break; - case Constants.UrlConstants.SAS_SIGNED_KEY_START: - tryAppendQueryParameter(sb, param, - this.keyStart == null ? null : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.keyStart)); - break; - case Constants.UrlConstants.SAS_SIGNED_KEY_EXPIRY: - tryAppendQueryParameter(sb, param, - this.keyExpiry == null ? null : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.keyExpiry)); - break; - case Constants.UrlConstants.SAS_SIGNED_KEY_SERVICE: - tryAppendQueryParameter(sb, param, this.keyService); - break; - case Constants.UrlConstants.SAS_SIGNED_KEY_VERSION: - tryAppendQueryParameter(sb, param, this.keyVersion); - break; - case Constants.UrlConstants.SAS_SIGNED_RESOURCE: - tryAppendQueryParameter(sb, param, this.resource); - break; - case Constants.UrlConstants.SAS_SIGNED_PERMISSIONS: - tryAppendQueryParameter(sb, param, this.permissions); - break; - case Constants.UrlConstants.SAS_SIGNATURE: - tryAppendQueryParameter(sb, param, this.signature); - break; - case Constants.UrlConstants.SAS_CACHE_CONTROL: - tryAppendQueryParameter(sb, param, this.cacheControl); - break; - case Constants.UrlConstants.SAS_CONTENT_DISPOSITION: - tryAppendQueryParameter(sb, param, this.contentDisposition); - break; - case Constants.UrlConstants.SAS_CONTENT_ENCODING: - tryAppendQueryParameter(sb, param, this.contentEncoding); - break; - case Constants.UrlConstants.SAS_CONTENT_LANGUAGE: - tryAppendQueryParameter(sb, param, this.contentLanguage); - break; - case Constants.UrlConstants.SAS_CONTENT_TYPE: - tryAppendQueryParameter(sb, param, this.contentType); - break; - default: - throw new IllegalArgumentException("Invalid URL constant."); - } - } - return sb.toString(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/SR.java b/storage/client/src/main/java/com/azure/storage/blob/SR.java deleted file mode 100644 index 6806fbc87c799..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/SR.java +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -/** - * RESERVED FOR INTERNAL USE. Provides a standard set of errors that could be thrown from the client library. - */ -final class SR { - // TODO: Do we want to keep any of what's left? - public static final String ACCOUNT_NAME_NULL_OR_EMPTY = "The account name is null or empty."; - public static final String ACCOUNT_NAME_MISMATCH = "The account name does not match the existing account name on the credentials."; - public static final String ARGUMENT_NULL_OR_EMPTY = "The argument must not be null or an empty string. Argument name: %s."; - public static final String ARGUMENT_OUT_OF_RANGE_ERROR = "The argument is out of range. Argument name: %s, Value passed: %s."; - public static final String BLOB_OVER_MAX_BLOCK_LIMIT = "The total blocks for this upload exceeds the maximum allowable limit."; - public static final String BLOB_DATA_CORRUPTED = "Blob data corrupted (integrity check failed), Expected value is %s, retrieved %s"; - public static final String BLOB_ENDPOINT_NOT_CONFIGURED = "No blob endpoint configured."; - public static final String BLOB_HASH_MISMATCH = "Blob hash mismatch (integrity check failed), Expected value is %s, retrieved %s."; - public static final String BLOB_MD5_NOT_SUPPORTED_FOR_PAGE_BLOBS = "Blob level MD5 is not supported for page blobs."; - public static final String CANNOT_CREATE_SAS_FOR_GIVEN_CREDENTIALS = "Cannot create Shared Access Signature as the credentials does not have account name information. Please check that the credentials provided support creating Shared Access Signature."; - public static final String CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY = "Cannot create Shared Access Signature unless the Account Key credentials are used by the ServiceClient."; - public static final String CANNOT_TRANSFORM_NON_HTTPS_URI_WITH_HTTPS_ONLY_CREDENTIALS = "Cannot use HTTP with credentials that only support HTTPS."; - public static final String CONTAINER = "container"; - public static final String CONTENT_LENGTH_MISMATCH = "An incorrect number of bytes was read from the connection. The connection may have been closed."; - public static final String CREATING_NETWORK_STREAM = "Creating a NetworkInputStream and expecting to read %s bytes."; - public static final String CREDENTIALS_CANNOT_SIGN_REQUEST = "CloudBlobClient, CloudQueueClient and CloudTableClient require credentials that can sign a request."; - public static final String DEFAULT_SERVICE_VERSION_ONLY_SET_FOR_BLOB_SERVICE = "DefaultServiceVersion can only be set for the Blob service."; - public static final String DELETE_SNAPSHOT_NOT_VALID_ERROR = "The option '%s' must be 'None' to delete a specific snapshot specified by '%s'."; - public static final String ENUMERATION_ERROR = "An error occurred while enumerating the result, check the original exception for details."; - public static final String ENDPOINT_INFORMATION_UNAVAILABLE = "Endpoint information not available for Account using Shared Access Credentials."; - public static final String ETAG_INVALID_FOR_DELETE = "Delete requires a valid ETag (which may be the '*' wildcard)."; - public static final String ETAG_INVALID_FOR_MERGE = "Merge requires a valid ETag (which may be the '*' wildcard)."; - public static final String ETAG_INVALID_FOR_UPDATE = "Replace requires a valid ETag (which may be the '*' wildcard)."; - public static final String ENUM_COULD_NOT_BE_PARSED_INVALID_VALUE = "%s could not be parsed from '%s' due to invalid value %s."; - public static final String INCORRECT_STREAM_LENGTH = "An incorrect stream length was specified, resulting in an authentication failure. Please specify correct length, or -1."; - public static final String INPUT_STREAM_SHOULD_BE_MARKABLE = "Input stream must be markable."; - public static final String INVALID_ACCOUNT_NAME = "Invalid account name."; - public static final String INVALID_ACL_ACCESS_TYPE = "Invalid acl public access type returned '%s'. Expected blob or container."; - public static final String INVALID_BLOB_TYPE = "Incorrect Blob type, please use the correct Blob type to access a blob on the server. Expected %s, actual %s."; - public static final String INVALID_BLOCK_ID = "Invalid blockID, blockID must be a valid Base64 String."; - public static final String INVALID_BLOCK_SIZE = "Block data should not exceed BlockBlobURL.MAX_STAGE_BLOCK_BYTES"; - public static final String INVALID_CONDITIONAL_HEADERS = "The conditionals specified for this operation did not match server."; - public static final String INVALID_CONNECTION_STRING = "Invalid connection string."; - public static final String INVALID_CONNECTION_STRING_DEV_STORE_NOT_TRUE = "Invalid connection string, the UseDevelopmentStorage key must always be paired with 'true'. Remove the flag entirely otherwise."; - public static final String INVALID_CONTENT_LENGTH = "ContentLength must be set to -1 or positive Long value."; - public static final String INVALID_CONTENT_TYPE = "An incorrect Content-Type was returned from the server."; - public static final String INVALID_CORS_RULE = "A CORS rule must contain at least one allowed origin and allowed method, and MaxAgeInSeconds cannot have a value less than zero."; - public static final String INVALID_DATE_STRING = "Invalid Date String: %s."; - public static final String INVALID_EDMTYPE_VALUE = "Invalid value '%s' for EdmType."; - public static final String INVALID_FILE_LENGTH = "File length must be greater than or equal to 0 bytes."; - public static final String INVALID_GEO_REPLICATION_STATUS = "Null or Invalid geo-replication status in response: %s."; - public static final String INVALID_IP_ADDRESS = "Error when parsing IPv4 address: IP address '%s' is invalid."; - public static final String INVALID_KEY = "Storage Key is not a valid base64 encoded string."; - public static final String INVALID_LISTING_DETAILS = "Invalid blob listing details specified."; - public static final String INVALID_LOGGING_LEVEL = "Invalid logging operations specified."; - public static final String INVALID_MAX_WRITE_SIZE = "Max write size is 4MB. Please specify a smaller range."; - public static final String INVALID_MESSAGE_LENGTH = "The message size cannot be larger than %s bytes."; - public static final String INVALID_MIME_RESPONSE = "Invalid MIME response received."; - public static final String INVALID_NUMBER_OF_BYTES_IN_THE_BUFFER = "Page data must be a multiple of 512 bytes. Buffer currently contains %d bytes."; - public static final String INVALID_OPERATION_FOR_A_SNAPSHOT = "Cannot perform this operation on a blob representing a snapshot."; - public static final String INVALID_PAGE_BLOB_LENGTH = "Page blob length must be multiple of 512."; - public static final String INVALID_PAGE_START_OFFSET = "Page start offset must be multiple of 512."; - public static final String INVALID_RANGE_CONTENT_MD5_HEADER = "Cannot specify x-ms-range-get-content-md5 header on ranges larger than 4 MB. Either use a BlobReadStream via openRead, or disable TransactionalMD5 via the BlobRequestOptions."; - public static final String INVALID_RESOURCE_NAME = "Invalid %s name. Check MSDN for more information about valid naming."; - public static final String INVALID_RESOURCE_NAME_LENGTH = "Invalid %s name length. The name must be between %s and %s characters long."; - public static final String INVALID_RESOURCE_RESERVED_NAME = "Invalid %s name. This name is reserved."; - public static final String INVALID_RESPONSE_RECEIVED = "The response received is invalid or improperly formatted."; - public static final String INVALID_STORAGE_PROTOCOL_VERSION = "Storage protocol version prior to 2009-09-19 do not support shared key authentication."; - public static final String INVALID_STORAGE_SERVICE = "Invalid storage service specified."; - public static final String INVALID_STREAM_LENGTH = "Invalid stream length; stream must be between 0 and %s MB in length."; - public static final String ITERATOR_EMPTY = "There are no more elements in this enumeration."; - public static final String KEY_AND_RESOLVER_MISSING = "Key and Resolver are not initialized. Decryption requires either of them to be initialized."; - public static final String LEASE_CONDITION_ON_SOURCE = "A lease condition cannot be specified on the source of a copy."; - public static final String LOG_STREAM_END_ERROR = "Error parsing log record: unexpected end of stream."; - public static final String LOG_STREAM_DELIMITER_ERROR = "Error parsing log record: unexpected delimiter encountered."; - public static final String LOG_STREAM_QUOTE_ERROR = "Error parsing log record: unexpected quote character encountered."; - public static final String LOG_VERSION_UNSUPPORTED = "A storage log version of %s is unsupported."; - public static final String MARK_EXPIRED = "Stream mark expired."; - public static final String MAXIMUM_EXECUTION_TIMEOUT_EXCEPTION = "The client could not finish the operation within specified maximum execution timeout."; - public static final String MISSING_CREDENTIALS = "No credentials provided."; - public static final String MISSING_MANDATORY_DATE_HEADER = "Canonicalization did not find a non-empty x-ms-date header in the request. Please use a request with a valid x-ms-date header in RFC 123 format."; - public static final String MISSING_MANDATORY_PARAMETER_FOR_SAS = "Missing mandatory parameters for valid Shared Access Signature."; - public static final String MISSING_MD5 = "ContentMD5 header is missing in the response."; - public static final String MISSING_NULLARY_CONSTRUCTOR = "Class type must contain contain a nullary constructor."; - public static final String MULTIPLE_CREDENTIALS_PROVIDED = "Cannot provide credentials as part of the address and as constructor parameter. Either pass in the address or use a different constructor."; - public static final String PARAMETER_NOT_IN_RANGE = "The value of the parameter '%s' should be between %s and %s."; - public static final String PARAMETER_SHOULD_BE_GREATER = "The value of the parameter '%s' should be greater than %s."; - public static final String PARAMETER_SHOULD_BE_GREATER_OR_EQUAL = "The value of the parameter '%s' should be greater than or equal to %s."; - public static final String PATH_STYLE_URI_MISSING_ACCOUNT_INFORMATION = "Missing account name information inside path style URI. Path style URIs should be of the form http:///"; - public static final String PRIMARY_ONLY_COMMAND = "This operation can only be executed against the primary storage location."; - public static final String PROPERTY_CANNOT_BE_SERIALIZED_AS_GIVEN_EDMTYPE = "Property %s with Edm Type %s cannot be de-serialized."; - public static final String PRECONDITION_FAILURE_IGNORED = "Pre-condition failure on a retry is being ignored since the request should have succeeded in the first attempt."; - public static final String RELATIVE_ADDRESS_NOT_PERMITTED = "Address %s is a relative address. Only absolute addresses are permitted."; - public static final String RESOURCE_NAME_EMPTY = "Invalid %s name. The name may not be null, empty, or whitespace only."; - public static final String RESPONSE_RECEIVED_IS_INVALID = "The response received is invalid or improperly formatted."; - public static final String SCHEME_NULL_OR_EMPTY = "The protocol to use is null. Please specify whether to use http or https."; - public static final String SECONDARY_ONLY_COMMAND = "This operation can only be executed against the secondary storage location."; - public static final String SNAPSHOT_LISTING_ERROR = "Listing snapshots is only supported in flat mode (no delimiter). Consider setting useFlatBlobListing to true."; - public static final String SNAPSHOT_QUERY_OPTION_ALREADY_DEFINED = "Snapshot query parameter is already defined in the blob URI. Either pass in a snapshotTime parameter or use a full URL with a snapshot query parameter."; - public static final String STORAGE_CREDENTIALS_NULL_OR_ANONYMOUS = "StorageCredentials cannot be null or anonymous for this service."; - public static final String STORAGE_CLIENT_OR_SAS_REQUIRED = "Either a SAS token or a service client must be specified."; - public static final String STORAGE_URI_MISSING_LOCATION = "The URI for the target storage location is not specified. Please consider changing the request's location mode."; - public static final String STORAGE_URI_MUST_MATCH = "Primary and secondary location URIs in a StorageUri must point to the same resource."; - public static final String STORAGE_URI_NOT_NULL = "Primary and secondary location URIs in a StorageUri must not both be null."; - public static final String STREAM_CLOSED = "Stream is already closed."; - public static final String STREAM_SKIP_FAILED = "The supplied stream has failed to skip to the correct position after successive attempts. Please ensure there are bytes available and try your upload again."; - public static final String STREAM_LENGTH_GREATER_THAN_4MB = "Invalid stream length, length must be less than or equal to 4 MB in size."; - public static final String STREAM_LENGTH_GREATER_THAN_100MB = "Invalid stream length, length must be less than or equal to 100 MB in size."; - public static final String STREAM_LENGTH_NEGATIVE = "Invalid stream length, specify -1 for unknown length stream, or a positive number of bytes."; - public static final String STRING_NOT_VALID = "The String is not a valid Base64-encoded string."; - public static final String TAKE_COUNT_ZERO_OR_NEGATIVE = "Take count must be positive and greater than 0."; - public static final String TOO_MANY_PATH_SEGMENTS = "The count of URL path segments (strings between '/' characters) as part of the blob name cannot exceed 254."; - public static final String TOO_MANY_SHARED_ACCESS_POLICY_IDENTIFIERS = "Too many %d shared access policy identifiers provided. Server does not support setting more than %d on a single container, queue, or table."; - public static final String TOO_MANY_SHARED_ACCESS_POLICY_IDS = "Too many %d shared access policy identifiers provided. Server does not support setting more than %d on a single container."; - public static final String UNEXPECTED_CONTINUATION_TYPE = "The continuation type passed in is unexpected. Please verify that the correct continuation type is passed in. Expected {%s}, found {%s}."; - public static final String UNEXPECTED_FIELD_NAME = "Unexpected field name. Expected: '%s'. Actual: '%s'."; - public static final String UNEXPECTED_STATUS_CODE_RECEIVED = "Unexpected http status code received."; - public static final String UNEXPECTED_STREAM_READ_ERROR = "Unexpected error. Stream returned unexpected number of bytes."; -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/ServiceSASSignatureValues.java b/storage/client/src/main/java/com/azure/storage/blob/ServiceSASSignatureValues.java deleted file mode 100644 index 26ab4f8a4db7f..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/ServiceSASSignatureValues.java +++ /dev/null @@ -1,467 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.storage.blob.models.UserDelegationKey; - -import java.security.InvalidKeyException; -import java.time.OffsetDateTime; - -/** - * ServiceSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage service. Once - * all the values here are set appropriately, call generateSASQueryParameters to obtain a representation of the SAS - * which can actually be applied to blob urls. Note: that both this class and {@link SASQueryParameters} exist because - * the former is mutable and a logical representation while the latter is immutable and used to generate actual REST - * requests. - *

- * Please see here - * for more conceptual information on SAS. - *

- * Please see here for - * more details on each value, including which are required. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_sas "Sample code for ServiceSASSignatureValues")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ -final class ServiceSASSignatureValues { - - private String version = Constants.HeaderConstants.TARGET_STORAGE_VERSION; - - private SASProtocol protocol; - - private OffsetDateTime startTime; - - private OffsetDateTime expiryTime; - - private String permissions; - - private IPRange ipRange; - - private String containerName; - - private String blobName; - - private String snapshotId; - - private String identifier; - - private String cacheControl; - - private String contentDisposition; - - private String contentEncoding; - - private String contentLanguage; - - private String contentType; - - /** - * Creates an object with empty values for all fields. - */ - public ServiceSASSignatureValues() { - } - - /** - * The version of the service this SAS will target. If not specified, it will default to the version targeted by the - * library. - */ - public String version() { - return version; - } - - /** - * The version of the service this SAS will target. If not specified, it will default to the version targeted by the - * library. - */ - public ServiceSASSignatureValues withVersion(String version) { - this.version = version; - return this; - } - - /** - * {@link SASProtocol} - */ - public SASProtocol protocol() { - return protocol; - } - - /** - * {@link SASProtocol} - */ - public ServiceSASSignatureValues withProtocol(SASProtocol protocol) { - this.protocol = protocol; - return this; - } - - /** - * When the SAS will take effect. - */ - public OffsetDateTime startTime() { - return startTime; - } - - /** - * When the SAS will take effect. - */ - public ServiceSASSignatureValues withStartTime(OffsetDateTime startTime) { - this.startTime = startTime; - return this; - } - - /** - * The time after which the SAS will no longer work. - */ - public OffsetDateTime expiryTime() { - return expiryTime; - } - - /** - * The time after which the SAS will no longer work. - */ - public ServiceSASSignatureValues withExpiryTime(OffsetDateTime expiryTime) { - this.expiryTime = expiryTime; - return this; - } - - /** - * Please refer to either {@link ContainerSASPermission} or {@link BlobSASPermission} depending on the resource - * being accessed for help constructing the permissions string. - */ - public String permissions() { - return permissions; - } - - /** - * Please refer to either {@link ContainerSASPermission} or {@link BlobSASPermission} depending on the resource - * being accessed for help constructing the permissions string. - */ - public ServiceSASSignatureValues withPermissions(String permissions) { - this.permissions = permissions; - return this; - } - - /** - * {@link IPRange} - */ - public IPRange ipRange() { - return ipRange; - } - - /** - * {@link IPRange} - */ - public ServiceSASSignatureValues withIpRange(IPRange ipRange) { - this.ipRange = ipRange; - return this; - } - - /** - * The name of the container the SAS user may access. - */ - public String containerName() { - return containerName; - } - - /** - * The name of the container the SAS user may access. - */ - public ServiceSASSignatureValues withContainerName(String containerName) { - this.containerName = containerName; - return this; - } - - /** - * The name of the blob the SAS user may access. - */ - public String blobName() { - return blobName; - } - - /** - * The name of the blob the SAS user may access. - */ - public ServiceSASSignatureValues withBlobName(String blobName) { - this.blobName = blobName; - return this; - } - - /** - * The specific snapshot the SAS user may access. - */ - public String snapshotId() { - return snapshotId; - } - - /** - * The specific snapshot the SAS user may access. - */ - public ServiceSASSignatureValues withSnapshotId(String snapshotId) { - this.snapshotId = snapshotId; - return this; - } - - /** - * The name of the access policy on the container this SAS references if any. Please see - * here - * for more information. - */ - public String identifier() { - return identifier; - } - - /** - * The name of the access policy on the container this SAS references if any. Please see - * here - * for more information. - */ - public ServiceSASSignatureValues withIdentifier(String identifier) { - this.identifier = identifier; - return this; - } - - /** - * The cache-control header for the SAS. - */ - public String cacheControl() { - return cacheControl; - } - - /** - * The cache-control header for the SAS. - */ - public ServiceSASSignatureValues withCacheControl(String cacheControl) { - this.cacheControl = cacheControl; - return this; - } - - /** - * The content-disposition header for the SAS. - */ - public String contentDisposition() { - return contentDisposition; - } - - /** - * The content-disposition header for the SAS. - */ - public ServiceSASSignatureValues withContentDisposition(String contentDisposition) { - this.contentDisposition = contentDisposition; - return this; - } - - /** - * The content-encoding header for the SAS. - */ - public String contentEncoding() { - return contentEncoding; - } - - /** - * The content-encoding header for the SAS. - */ - public ServiceSASSignatureValues withContentEncoding(String contentEncoding) { - this.contentEncoding = contentEncoding; - return this; - } - - /** - * The content-language header for the SAS. - */ - public String contentLanguage() { - return contentLanguage; - } - - /** - * The content-language header for the SAS. - */ - public ServiceSASSignatureValues withContentLanguage(String contentLanguage) { - this.contentLanguage = contentLanguage; - return this; - } - - /** - * The content-type header for the SAS. - */ - public String contentType() { - return contentType; - } - - /** - * The content-type header for the SAS. - */ - public ServiceSASSignatureValues withContentType(String contentType) { - this.contentType = contentType; - return this; - } - - /** - * Uses an account's shared key credential to sign these signature values to produce the proper SAS query - * parameters. - * - * @param sharedKeyCredentials - * A {@link SharedKeyCredentials} object used to sign the SAS values. - * - * @return {@link SASQueryParameters} - */ - public SASQueryParameters generateSASQueryParameters(SharedKeyCredentials sharedKeyCredentials) { - Utility.assertNotNull("sharedKeyCredentials", sharedKeyCredentials); - assertGenerateOK(); - - String resource = getResource(); - String verifiedPermissions = getVerifiedPermissions(); - - // Signature is generated on the un-url-encoded values. - final String stringToSign = stringToSign(verifiedPermissions, resource, sharedKeyCredentials); - - String signature = null; - try { - signature = sharedKeyCredentials.computeHmac256(stringToSign); - } catch (InvalidKeyException e) { - throw new Error(e); // The key should have been validated by now. If it is no longer valid here, we fail. - } - - return new SASQueryParameters(this.version, null, null, - this.protocol, this.startTime, this.expiryTime, this.ipRange, this.identifier, resource, - this.permissions, signature, this.cacheControl, this.contentDisposition, this.contentEncoding, - this.contentLanguage, this.contentType, null /* delegate */); - } - - /** - * Uses a user delegation key to sign these signature values to produce the proper SAS query parameters. - * - * @param delegationKey - * A {@link UserDelegationKey} object used to sign the SAS values. - * - * @param accountName - * Name of the account holding the resource this SAS is authorizing. - * - * @return {@link SASQueryParameters} - */ - public SASQueryParameters generateSASQueryParameters(UserDelegationKey delegationKey, String accountName) { - Utility.assertNotNull("delegationKey", delegationKey); - Utility.assertNotNull("accountName", accountName); - assertGenerateOK(); - - String resource = getResource(); - String verifiedPermissions = getVerifiedPermissions(); - - // Signature is generated on the un-url-encoded values. - final String stringToSign = stringToSign(verifiedPermissions, resource, delegationKey, accountName); - - String signature = null; - try { - signature = Utility.delegateComputeHmac256(delegationKey, stringToSign); - } catch (InvalidKeyException e) { - throw new Error(e); // The key should have been validated by now. If it is no longer valid here, we fail. - } - - return new SASQueryParameters(this.version, null, null, - this.protocol, this.startTime, this.expiryTime, this.ipRange, null /* identifier */, resource, - this.permissions, signature, this.cacheControl, this.contentDisposition, this.contentEncoding, - this.contentLanguage, this.contentType, delegationKey); - } - - /** - * Common assertions for generateSASQueryParameters overloads. - */ - private void assertGenerateOK() { - Utility.assertNotNull("version", this.version); - Utility.assertNotNull("containerName", this.containerName); - if (blobName == null && snapshotId != null) { - throw new IllegalArgumentException("Cannot set a snapshotId without a blobName."); - } - } - - /** - * Gets the resource string for SAS tokens based on object state. - */ - private String getResource() { - String resource = "c"; - if (!Utility.isNullOrEmpty(this.blobName)) { - resource = snapshotId != null && !snapshotId.isEmpty() ? "bs" : "b"; - } - - return resource; - } - - /** - * Gets the verified permissions string for SAS tokens based on object state. - */ - private String getVerifiedPermissions() { - String verifiedPermissions = null; - // Calling parse and toString guarantees the proper ordering and throws on invalid characters. - if (Utility.isNullOrEmpty(this.blobName)) { - if (this.permissions != null) { - verifiedPermissions = ContainerSASPermission.parse(this.permissions).toString(); - } - } else { - if (this.permissions != null) { - verifiedPermissions = BlobSASPermission.parse(this.permissions).toString(); - } - } - - return verifiedPermissions; - } - - private String getCanonicalName(String accountName) { - // Container: "/blob/account/containername" - // Blob: "/blob/account/containername/blobname" - StringBuilder canonicalName = new StringBuilder("/blob"); - canonicalName.append('/').append(accountName).append('/').append(this.containerName); - - if (!Utility.isNullOrEmpty(this.blobName)) { - canonicalName.append("/").append(this.blobName); - } - - return canonicalName.toString(); - } - - private String stringToSign(final String verifiedPermissions, final String resource, - final SharedKeyCredentials sharedKeyCredentials) { - return String.join("\n", - verifiedPermissions == null ? "" : verifiedPermissions, - this.startTime == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.startTime), - this.expiryTime == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.expiryTime), - getCanonicalName(sharedKeyCredentials.getAccountName()), - this.identifier == null ? "" : this.identifier, - this.ipRange == null ? (new IPRange()).toString() : this.ipRange.toString(), - this.protocol == null ? "" : protocol.toString(), - this.version == null ? "" : this.version, - resource == null ? "" : resource, - this.snapshotId == null ? "" : this.snapshotId, - this.cacheControl == null ? "" : this.cacheControl, - this.contentDisposition == null ? "" : this.contentDisposition, - this.contentEncoding == null ? "" : this.contentEncoding, - this.contentLanguage == null ? "" : this.contentLanguage, - this.contentType == null ? "" : this.contentType - ); - } - - private String stringToSign(final String verifiedPermissions, final String resource, - final UserDelegationKey key, final String accountName) { - return String.join("\n", - verifiedPermissions == null ? "" : verifiedPermissions, - this.startTime == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.startTime), - this.expiryTime == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(this.expiryTime), - getCanonicalName(accountName), - key.signedOid() == null ? "" : key.signedOid(), - key.signedTid() == null ? "" : key.signedTid(), - key.signedStart() == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(key.signedStart()), - key.signedExpiry() == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(key.signedExpiry()), - key.signedService() == null ? "" : key.signedService(), - key.signedVersion() == null ? "" : key.signedVersion(), - this.ipRange == null ? new IPRange().toString() : this.ipRange.toString(), - this.protocol == null ? "" : this.protocol.toString(), - this.version == null ? "" : this.version, - resource == null ? "" : resource, - this.snapshotId == null ? "" : this.snapshotId, - this.cacheControl == null ? "" : this.cacheControl, - this.contentDisposition == null ? "" : this.contentDisposition, - this.contentEncoding == null ? "" : this.contentEncoding, - this.contentLanguage == null ? "" : this.contentLanguage, - this.contentType == null ? "" : this.contentType - ); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/SetResponseFieldPolicy.java b/storage/client/src/main/java/com/azure/storage/blob/SetResponseFieldPolicy.java deleted file mode 100644 index 93ccdcfb19e0b..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/SetResponseFieldPolicy.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipelineCallContext; -import com.azure.core.http.HttpPipelineNextPolicy; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.policy.HttpPipelinePolicy; -import reactor.core.publisher.Mono; - -/** - * This is a factory which creates policies in an {@link com.azure.core.http.HttpPipeline} for setting the request property on the response - * object. This is necessary because of a bug in autorest which fails to set this property. In most cases, it is - * sufficient to allow the default pipeline to add this factory automatically and assume that it works. The factory and - * policy must only be used directly when creating a custom pipeline. - */ -final class SetResponseFieldPolicy implements HttpPipelinePolicy { - - @Override - public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - return next.process() - .map(response -> - response.request(context.httpRequest())); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/SharedKeyCredentials.java b/storage/client/src/main/java/com/azure/storage/blob/SharedKeyCredentials.java deleted file mode 100644 index 46dd1c46d37fd..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/SharedKeyCredentials.java +++ /dev/null @@ -1,249 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.*; -import io.netty.handler.codec.http.HttpResponseStatus; -import io.netty.handler.codec.http.QueryStringDecoder; -import reactor.core.publisher.Mono; - -import javax.crypto.Mac; -import javax.crypto.spec.SecretKeySpec; -import java.io.UnsupportedEncodingException; -import java.net.URL; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.Base64; -import java.util.Collections; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.StreamSupport; - -/** - * SharedKeyCredentials are a means of signing and authenticating storage requests. The key can be obtained from the - * Azure portal. This factory will create policies which take care of all the details of creating strings to sign, - * signing them, and setting the Authentication header. While this is a common way of authenticating with the service, - * recommended practice is using {@link TokenCredentials}. Pass this as the credentials in the construction of a new - * {@link HttpPipeline} via the {@link StorageURL} type. - */ -public final class SharedKeyCredentials implements ICredentials { - - private final String accountName; - - private final byte[] accountKey; - - /** - * Initializes a new instance of SharedKeyCredentials contains an account's name and its primary or secondary - * accountKey. - * - * @param accountName The account name associated with the request. - * @param accountKey The account access key used to authenticate the request. - */ - public SharedKeyCredentials(String accountName, String accountKey) { - this.accountName = accountName; - this.accountKey = Base64.getDecoder().decode(accountKey); - } - - /** - * Gets the account name associated with the request. - * - * @return The account name. - */ - public String getAccountName() { - return accountName; - } - - /** - * Constructs a canonicalized string for signing a request. - * - * @param request The request to canonicalize. - * @return A canonicalized string. - */ - private String buildStringToSign(final HttpRequest request) { - final HttpHeaders httpHeaders = request.headers(); - String contentLength = getStandardHeaderValue(httpHeaders, Constants.HeaderConstants.CONTENT_LENGTH); - contentLength = contentLength.equals("0") ? Constants.EMPTY_STRING : contentLength; - - return String.join("\n", - request.httpMethod().toString(), - getStandardHeaderValue(httpHeaders, Constants.HeaderConstants.CONTENT_ENCODING), - getStandardHeaderValue(httpHeaders, Constants.HeaderConstants.CONTENT_LANGUAGE), - contentLength, - getStandardHeaderValue(httpHeaders, Constants.HeaderConstants.CONTENT_MD5), - getStandardHeaderValue(httpHeaders, Constants.HeaderConstants.CONTENT_TYPE), - // x-ms-date header exists, so don't sign date header - Constants.EMPTY_STRING, - getStandardHeaderValue(httpHeaders, Constants.HeaderConstants.IF_MODIFIED_SINCE), - getStandardHeaderValue(httpHeaders, Constants.HeaderConstants.IF_MATCH), - getStandardHeaderValue(httpHeaders, Constants.HeaderConstants.IF_NONE_MATCH), - getStandardHeaderValue(httpHeaders, Constants.HeaderConstants.IF_UNMODIFIED_SINCE), - getStandardHeaderValue(httpHeaders, Constants.HeaderConstants.RANGE), - getAdditionalXmsHeaders(httpHeaders), - getCanonicalizedResource(request.url()) - ); - } - - private String getAdditionalXmsHeaders(final HttpHeaders headers) { - // Add only headers that begin with 'x-ms-' - final List xmsHeaderNameArray = StreamSupport.stream(headers.spliterator(), false) - .filter(header -> header.value() != null) - .map(header -> header.name().toLowerCase(Locale.ROOT)) - .filter(lowerCaseHeader -> lowerCaseHeader.startsWith(Constants.PREFIX_FOR_STORAGE_HEADER)) - .collect(Collectors.toList()); // ArrayList under hood - - // TODO the stream filter solves an issue where we are adding null value headers. We should not add them in the first place, this filter is a perf hit, especially on large metadata collections - -// for (HttpHeader header : headers) { -// String lowerCaseHeader = header.name().toLowerCase(Locale.ROOT); -// if (lowerCaseHeader.startsWith(Constants.PREFIX_FOR_STORAGE_HEADER)) { -// xmsHeaderNameArray.add(lowerCaseHeader); -// } -// } - - if (xmsHeaderNameArray.isEmpty()) { - return Constants.EMPTY_STRING; - } - - Collections.sort(xmsHeaderNameArray); - - final StringBuilder canonicalizedHeaders = new StringBuilder(); - for (final String key : xmsHeaderNameArray) { - if (canonicalizedHeaders.length() > 0) { - canonicalizedHeaders.append('\n'); - } - - canonicalizedHeaders.append(key); - canonicalizedHeaders.append(':'); - canonicalizedHeaders.append(headers.value(key)); - } - - return canonicalizedHeaders.toString(); - } - - /** - * Canonicalized the resource to sign. - * - * @param requestURL A {@code java.net.URL} of the request. - * @return The canonicalized resource to sign. - */ - private String getCanonicalizedResource(URL requestURL) { - - // Resource path - final StringBuilder canonicalizedResource = new StringBuilder("/"); - canonicalizedResource.append(this.accountName); - - // Note that AbsolutePath starts with a '/'. - if (requestURL.getPath().length() > 0) { - canonicalizedResource.append(requestURL.getPath()); - } else { - canonicalizedResource.append('/'); - } - - // check for no query params and return - if (requestURL.getQuery() == null) { - return canonicalizedResource.toString(); - } - - // The URL object's query field doesn't include the '?'. The QueryStringDecoder expects it. - QueryStringDecoder queryDecoder = new QueryStringDecoder("?" + requestURL.getQuery()); - Map> queryParams = queryDecoder.parameters(); - - ArrayList queryParamNames = new ArrayList<>(queryParams.keySet()); - Collections.sort(queryParamNames); - - for (String queryParamName : queryParamNames) { - final List queryParamValues = queryParams.get(queryParamName); - Collections.sort(queryParamValues); - String queryParamValuesStr = String.join(",", queryParamValues.toArray(new String[]{})); - canonicalizedResource.append("\n").append(queryParamName.toLowerCase(Locale.ROOT)).append(":") - .append(queryParamValuesStr); - } - - // append to main string appendBlobClientBuilder the join of completed params with new line - return canonicalizedResource.toString(); - } - - /** - * Returns the standard header value from the specified connection request, or an empty string if no header value - * has been specified for the request. - * - * @param httpHeaders A {@code HttpHeaders} object that represents the headers for the request. - * @param headerName A {@code String} that represents the name of the header being requested. - * @return A {@code String} that represents the header value, or {@code null} if there is no corresponding - * header value for {@code headerName}. - */ - private String getStandardHeaderValue(final HttpHeaders httpHeaders, final String headerName) { - final String headerValue = httpHeaders.value(headerName); - - return headerValue == null ? Constants.EMPTY_STRING : headerValue; - } - - /** - * Computes a signature for the specified string using the HMAC-SHA256 algorithm. - * Package-private because it is used to generate SAS signatures. - * - * @param stringToSign The UTF-8-encoded string to sign. - * @return A {@code String} that contains the HMAC-SHA256-encoded signature. - * @throws InvalidKeyException If the accountKey is not a valid Base64-encoded string. - */ - String computeHmac256(final String stringToSign) throws InvalidKeyException { - try { - /* - We must get a new instance of the Mac calculator for each signature calculated because the instances are - not threadsafe and there is some suggestion online that they may not even be safe for reuse, so we use a - new one each time to be sure. - */ - Mac hmacSha256 = Mac.getInstance("HmacSHA256"); - hmacSha256.init(new SecretKeySpec(this.accountKey, "HmacSHA256")); - byte[] utf8Bytes = stringToSign.getBytes(Constants.UTF8_CHARSET); - return Base64.getEncoder().encodeToString(hmacSha256.doFinal(utf8Bytes)); - } catch (final UnsupportedEncodingException | NoSuchAlgorithmException e) { - throw new Error(e); - } - } - - - /** - * Sign the request. - * - * @param context - * The call context. - * @param next - * The next policy to process. - * - * @return A {@link Mono} representing the HTTP response that will arrive asynchronously. - */ - @Override - public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - if (context.httpRequest().headers().value(Constants.HeaderConstants.DATE) == null) { - context.httpRequest().headers().put(Constants.HeaderConstants.DATE, - Utility.RFC_1123_GMT_DATE_FORMATTER.format(OffsetDateTime.now())); - } - final String stringToSign = this.buildStringToSign(context.httpRequest()); - try { - final String computedBase64Signature = this.computeHmac256(stringToSign); - context.httpRequest().headers().put(Constants.HeaderConstants.AUTHORIZATION, - "SharedKey " + this.accountName + ":" + computedBase64Signature); - } catch (Exception e) { - return Mono.error(e); - } - - Mono response = next.process(); - return response.doOnSuccess(response1 -> { - if (response1.statusCode() == HttpResponseStatus.FORBIDDEN.code()) { - // TODO temporarily disabled for user study deadline. should renable later - /*if (options.shouldLog(HttpPipelineLogLevel.ERROR)) { - options.log(HttpPipelineLogLevel.ERROR, - "===== HTTP Forbidden status, String-to-Sign:%n'%s'%n==================%n", - stringToSign); - }*/ - } - }); - } -} - diff --git a/storage/client/src/main/java/com/azure/storage/blob/StorageAccountInfo.java b/storage/client/src/main/java/com/azure/storage/blob/StorageAccountInfo.java deleted file mode 100644 index 4fea499e69e49..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/StorageAccountInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.azure.storage.blob; - -import com.azure.storage.blob.models.*; - -public class StorageAccountInfo { - - private SkuName skuName; - - private AccountKind accountKind; - - - StorageAccountInfo(BlobGetAccountInfoHeaders generatedResponseHeaders) { - this.skuName = generatedResponseHeaders.skuName(); - this.accountKind = generatedResponseHeaders.accountKind(); - } - - StorageAccountInfo(ContainerGetAccountInfoHeaders generatedResponseHeaders) { - this.skuName = generatedResponseHeaders.skuName(); - this.accountKind = generatedResponseHeaders.accountKind(); - } - - StorageAccountInfo(ServiceGetAccountInfoHeaders generatedResponseHeaders) { - this.skuName = generatedResponseHeaders.skuName(); - this.accountKind = generatedResponseHeaders.accountKind(); - } - - - public SkuName skuName() { - return skuName; - } - - public AccountKind accountKind() { - return accountKind; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/StorageAsyncClient.java b/storage/client/src/main/java/com/azure/storage/blob/StorageAsyncClient.java deleted file mode 100644 index eaee79e1a1220..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/StorageAsyncClient.java +++ /dev/null @@ -1,317 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.rest.ResponseBase; -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.ContainerItem; -import com.azure.storage.blob.models.ServicesListContainersSegmentResponse; -import com.azure.storage.blob.models.StorageServiceProperties; -import com.azure.storage.blob.models.StorageServiceStats; -import com.azure.storage.blob.models.UserDelegationKey; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.net.MalformedURLException; -import java.net.URL; -import java.time.OffsetDateTime; - -/** - * Client to a storage account. It may only be instantiated through a {@link StorageClientBuilder}. - * This class does not hold any state about a particular storage account but is - * instead a convenient way of sending off appropriate requests to the resource on the service. - * It may also be used to construct URLs to blobs and containers. - * - *

- * This client contains operations on a blob. Operations on a container are available on {@link ContainerAsyncClient} - * through {@link #getContainerAsyncClient(String)}, and operations on a blob are available on {@link BlobAsyncClient}. - * - *

- * Please see here for more - * information on containers. - * - *

- * Note this client is an async client that returns reactive responses from Spring Reactor Core - * project (https://projectreactor.io/). Calling the methods in this client will NOT - * start the actual network operation, until {@code .subscribe()} is called on the reactive response. - * You can simply convert one of these responses to a {@link java.util.concurrent.CompletableFuture} - * object through {@link Mono#toFuture()}. - */ -public final class StorageAsyncClient { - - StorageAsyncRawClient storageAsyncRawClient; - private StorageClientBuilder builder; - - /** - * Package-private constructor for use by {@link StorageClientBuilder}. - * @param azureBlobStorage the API client for blob storage API - */ - StorageAsyncClient(AzureBlobStorageImpl azureBlobStorage) { - this.storageAsyncRawClient = new StorageAsyncRawClient(azureBlobStorage); - } - - /** - * Static method for getting a new builder for this class. - * - * @return - * A new {@link StorageClientBuilder} instance. - */ - public static StorageClientBuilder storageClientBuilder() { - return new StorageClientBuilder(); - } - - /** - * Package-private constructor for use by {@link StorageClientBuilder}. - * @param builder the storage account client builder - */ - StorageAsyncClient(StorageClientBuilder builder) { - this.builder = builder; - this.storageAsyncRawClient = new StorageAsyncRawClient(builder.buildImpl()); - } - - /** - * Initializes a {@link ContainerAsyncClient} object pointing to the specified container. This method does not create a - * container. It simply constructs the URL to the container and offers access to methods relevant to containers. - * - * @param containerName - * The name of the container to point to. - * @return - * A {@link ContainerAsyncClient} object pointing to the specified container - */ - public ContainerAsyncClient getContainerAsyncClient(String containerName) { - try { - return new ContainerAsyncClient(this.builder.copyAsContainerBuilder().endpoint(Utility.appendToURLPath(new URL(builder.endpoint()), containerName).toString())); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - - /** - * Returns a reactive Publisher emitting all the containers in this account lazily as needed. For more information, see - * the Azure Docs. - * - * @return - * A reactive response emitting the list of containers. - */ - public Flux listContainers() { - return this.listContainers(new ListContainersOptions(), null); - } - - /** - * Returns a reactive Publisher emitting all the containers in this account lazily as needed. For more information, see - * the Azure Docs. - * - * @param options - * A {@link ListContainersOptions} which specifies what data should be returned by the service. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response emitting the list of containers. - */ - public Flux listContainers(ListContainersOptions options, Context context) { - return storageAsyncRawClient - .listContainersSegment(null, options, context) - .flatMapMany(response -> listContainersHelper(response.value().marker(), options, context, response)); - } - - private Flux listContainersHelper(String marker, ListContainersOptions options, Context context, - ServicesListContainersSegmentResponse response){ - Flux result = Flux.fromIterable(response.value().containerItems()); - if (response.value().nextMarker() != null) { - // Recursively add the continuation items to the observable. - result = result.concatWith(storageAsyncRawClient.listContainersSegment(marker, options, - context) - .flatMapMany((r) -> - listContainersHelper(response.value().nextMarker(), options, context, r))); - } - - return result; - } - - /** - * Gets the properties of a storage account’s Blob service. For more information, see the - * Azure Docs. - * - * @return - * A reactive response containing the storage account properties. - */ - public Mono getProperties() { - return this.getProperties(null); - } - - /** - * Gets the properties of a storage account’s Blob service. For more information, see the - * Azure Docs. - * - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the storage account properties. - */ - public Mono getProperties(Context context) { - return storageAsyncRawClient - .getProperties(context) - .map(ResponseBase::value); - } - - /** - * Sets properties for a storage account's Blob service endpoint. For more information, see the - * Azure Docs. - * Note that setting the default service version has no effect when using this client because this client explicitly - * sets the version header on each request, overriding the default. - * - * @param properties - * Configures the service. - * - * @return - * A reactive response containing the storage account properties. - */ - public Mono setProperties(StorageServiceProperties properties) { - return this.setProperties(properties, null); - } - - /** - * Sets properties for a storage account's Blob service endpoint. For more information, see the - * Azure Docs. - * Note that setting the default service version has no effect when using this client because this client explicitly - * sets the version header on each request, overriding the default. - * - * @param properties - * Configures the service. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the storage account properties. - */ - public Mono setProperties(StorageServiceProperties properties, Context context) { - return storageAsyncRawClient - .setProperties(properties, context) - .then(); - } - - /** - * Gets a user delegation key for use with this account's blob storage. - * Note: This method call is only valid when using {@link TokenCredentials} in this object's {@link HttpPipeline}. - * - * @param start - * Start time for the key's validity. Null indicates immediate start. - * @param expiry - * Expiration of the key's validity. - * - * @return - * A reactive response containing the user delegation key. - */ - public Mono getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry) { - return this.getUserDelegationKey(start, expiry, null); - } - - /** - * Gets a user delegation key for use with this account's blob storage. - * Note: This method call is only valid when using {@link TokenCredentials} in this object's {@link HttpPipeline}. - * - * @param start - * Start time for the key's validity. Null indicates immediate start. - * @param expiry - * Expiration of the key's validity. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the user delegation key. - */ - public Mono getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry, - Context context) { - return storageAsyncRawClient - .getUserDelegationKey(start, expiry, context) - .map(ResponseBase::value); - } - - /** - * Retrieves statistics related to replication for the Blob service. It is only available on the secondary - * location endpoint when read-access geo-redundant replication is enabled for the storage account. For more - * information, see the - * Azure Docs. - * - * @return - * A reactive response containing the storage account statistics. - */ - public Mono getStatistics() { - return this.getStatistics(null); - } - - /** - * Retrieves statistics related to replication for the Blob service. It is only available on the secondary - * location endpoint when read-access geo-redundant replication is enabled for the storage account. For more - * information, see the - * Azure Docs. - * - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the storage account statistics. - */ - public Mono getStatistics(Context context) { - return storageAsyncRawClient - .getStatistics(context) - .map(ResponseBase::value); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the - * Azure Docs. - * - * @return - * A reactive response containing the storage account info. - */ - public Mono getAccountInfo() { - return this.getAccountInfo(null); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the - * Azure Docs. - * - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * A reactive response containing the storage account info. - */ - public Mono getAccountInfo(Context context) { - return storageAsyncRawClient - .getAccountInfo(context) - .map(ResponseBase::deserializedHeaders) - .map(StorageAccountInfo::new); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/StorageAsyncRawClient.java b/storage/client/src/main/java/com/azure/storage/blob/StorageAsyncRawClient.java deleted file mode 100644 index 27dc3a57c4e70..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/StorageAsyncRawClient.java +++ /dev/null @@ -1,327 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.KeyInfo; -import com.azure.storage.blob.models.ServicesGetAccountInfoResponse; -import com.azure.storage.blob.models.ServicesGetPropertiesResponse; -import com.azure.storage.blob.models.ServicesGetStatisticsResponse; -import com.azure.storage.blob.models.ServicesGetUserDelegationKeyResponse; -import com.azure.storage.blob.models.ServicesListContainersSegmentResponse; -import com.azure.storage.blob.models.ServicesSetPropertiesResponse; -import com.azure.storage.blob.models.StorageServiceProperties; -import reactor.core.publisher.Mono; - -import java.net.MalformedURLException; -import java.net.URL; -import java.time.OffsetDateTime; - -import static com.azure.storage.blob.Utility.postProcessResponse; - -/** - * Represents a URL to a storage service. This class does not hold any state about a particular storage account but is - * instead a convenient way of sending off appropriate requests to the resource on the service. - * It may also be used to construct URLs to blobs and containers. - * Please see here for more - * information on containers. - */ -final class StorageAsyncRawClient { - - AzureBlobStorageImpl azureBlobStorage; - - /** - * Creates a {@code ServiceURL} object pointing to the account specified by the URL and using the provided pipeline - * to make HTTP requests. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_url "Sample code for ServiceURL constructor")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public StorageAsyncRawClient(AzureBlobStorageImpl azureBlobStorage) { - this.azureBlobStorage = azureBlobStorage; - } - - /** - * Returns a Mono segment of containers starting from the specified Marker. - * Use an empty marker to start enumeration from the beginning. Container names are returned in lexicographic order. - * After getting a segment, process it, and then call ListContainers again (passing the the previously-returned - * Marker) to get the next segment. For more information, see - * the Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListContainersSegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param options - * A {@link ListContainersOptions} which specifies what data should be returned by the service. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_list "Sample code for ServiceURL.listContainersSegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_list_helper "Helper code for ServiceURL.listContainersSegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono listContainersSegment(String marker, - ListContainersOptions options) { - return this.listContainersSegment(marker, options, null); - } - - /** - * Returns a Mono segment of containers starting from the specified Marker. - * Use an empty marker to start enumeration from the beginning. Container names are returned in lexicographic order. - * After getting a segment, process it, and then call ListContainers again (passing the the previously-returned - * Marker) to get the next segment. For more information, see - * the Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListContainersSegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param options - * A {@link ListContainersOptions} which specifies what data should be returned by the service. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_list "Sample code for ServiceURL.listContainersSegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_list_helper "Helper code for ServiceURL.listContainersSegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono listContainersSegment(String marker, - ListContainersOptions options, Context context) { - options = options == null ? new ListContainersOptions() : options; - context = context == null ? Context.NONE : context; - - return postProcessResponse( - this.azureBlobStorage.services().listContainersSegmentWithRestResponseAsync( - options.prefix(), marker, options.maxResults(), options.details().toIncludeType(), null, - null, context)); - } - - /** - * Gets the properties of a storage account’s Blob service. For more information, see the - * Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_getsetprops "Sample code for ServiceURL.getProperties")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getProperties() { - return this.getProperties(null); - } - - /** - * Gets the properties of a storage account’s Blob service. For more information, see the - * Azure Docs. - * - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_getsetprops "Sample code for ServiceURL.getProperties")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getProperties(Context context) { - context = context == null ? Context.NONE : context; - - return postProcessResponse( - this.azureBlobStorage.services().getPropertiesWithRestResponseAsync(null, null, context)); - } - - /** - * Sets properties for a storage account's Blob service endpoint. For more information, see the - * Azure Docs. - * Note that setting the default service version has no effect when using this client because this client explicitly - * sets the version header on each request, overriding the default. - * - * @param properties - * Configures the service. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_getsetprops "Sample code for ServiceURL.setProperties")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono setProperties(StorageServiceProperties properties) { - return this.setProperties(properties, null); - } - - /** - * Sets properties for a storage account's Blob service endpoint. For more information, see the - * Azure Docs. - * Note that setting the default service version has no effect when using this client because this client explicitly - * sets the version header on each request, overriding the default. - * - * @param properties - * Configures the service. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_getsetprops "Sample code for ServiceURL.setProperties")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono setProperties(StorageServiceProperties properties, Context context) { - context = context == null ? Context.NONE : context; - - return postProcessResponse( - this.azureBlobStorage.services().setPropertiesWithRestResponseAsync(properties, null, null, context)); - } - - /** - * Gets a user delegation key for use with this account's blob storage. - * Note: This method call is only valid when using {@link TokenCredentials} in this object's {@link HttpPipeline}. - * - * @param start - * Start time for the key's validity. Null indicates immediate start. - * @param expiry - * Expiration of the key's validity. - * - * @return Emits the successful response. - */ - public Mono getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry) { - return this.getUserDelegationKey(start, expiry, null); - } - - /** - * Gets a user delegation key for use with this account's blob storage. - * Note: This method call is only valid when using {@link TokenCredentials} in this object's {@link HttpPipeline}. - * - * @param start - * Start time for the key's validity. Null indicates immediate start. - * @param expiry - * Expiration of the key's validity. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - */ - public Mono getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry, - Context context) { - Utility.assertNotNull("expiry", expiry); - if (start != null && !start.isBefore(expiry)) { - throw new IllegalArgumentException("`start` must be null or a datetime before `expiry`."); - } - - context = context == null ? Context.NONE : context; - - return postProcessResponse( - this.azureBlobStorage.services().getUserDelegationKeyWithRestResponseAsync( - new KeyInfo() - .start(start == null ? "" : Utility.ISO_8601_UTC_DATE_FORMATTER.format(start)) - .expiry(Utility.ISO_8601_UTC_DATE_FORMATTER.format(expiry)), - null, null, context) - ); - } - - /** - * Retrieves statistics related to replication for the Blob service. It is only available on the secondary - * location endpoint when read-access geo-redundant replication is enabled for the storage account. For more - * information, see the - * Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_stats "Sample code for ServiceURL.getStats")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getStatistics() { - return this.getStatistics(null); - } - - /** - * Retrieves statistics related to replication for the Blob service. It is only available on the secondary - * location endpoint when read-access geo-redundant replication is enabled for the storage account. For more - * information, see the - * Azure Docs. - * - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_stats "Sample code for ServiceURL.getStats")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getStatistics(Context context) { - context = context == null ? Context.NONE : context; - - return postProcessResponse( - this.azureBlobStorage.services().getStatisticsWithRestResponseAsync(null, null, context)); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the - * Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=account_info "Sample code for ServiceURL.getAccountInfo")] \n - * For more samples, please see the [Samples file] (https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getAccountInfo() { - return this.getAccountInfo(null); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the - * Azure Docs. - * - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link com.azure.core.http.HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=account_info "Sample code for ServiceURL.getAccountInfo")] \n - * For more samples, please see the [Samples file] (https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public Mono getAccountInfo(Context context) { - context = context == null ? Context.NONE : context; - - return postProcessResponse( - this.azureBlobStorage.services().getAccountInfoWithRestResponseAsync(context)); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/StorageClient.java b/storage/client/src/main/java/com/azure/storage/blob/StorageClient.java deleted file mode 100644 index 11694ac2c4017..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/StorageClient.java +++ /dev/null @@ -1,317 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.ContainerItem; -import com.azure.storage.blob.models.StorageServiceProperties; -import com.azure.storage.blob.models.StorageServiceStats; -import com.azure.storage.blob.models.UserDelegationKey; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.net.MalformedURLException; -import java.net.URL; -import java.time.Duration; -import java.time.OffsetDateTime; - -/** - * Client to a storage account. It may only be instantiated through a {@link StorageClientBuilder}. - * This class does not hold any state about a particular storage account but is - * instead a convenient way of sending off appropriate requests to the resource on the service. - * It may also be used to construct URLs to blobs and containers. - * - *

- * This client contains operations on a blob. Operations on a container are available on {@link ContainerClient} - * through {@link #getContainerClient(String)}, and operations on a blob are available on {@link BlobClient}. - * - *

- * Please see here for more - * information on containers. - */ -public final class StorageClient { - - private StorageAsyncClient storageAsyncClient; - private StorageClientBuilder builder; - - /** - * Package-private constructor for use by {@link StorageClientBuilder}. - * @param azureBlobStorage the API client for blob storage API - */ - StorageClient(AzureBlobStorageImpl azureBlobStorage) { - this.storageAsyncClient = new StorageAsyncClient(azureBlobStorage); - } - - /** - * Static method for getting a new builder for this class. - * - * @return - * A new {@link StorageClientBuilder} instance. - */ - public static StorageClientBuilder storageClientBuilder() { - return new StorageClientBuilder(); - } - - /** - * Package-private constructor for use by {@link StorageClientBuilder}. - * @param builder the storage account client builder - */ - StorageClient(StorageClientBuilder builder) { - this.builder = builder; - this.storageAsyncClient = new StorageAsyncClient(builder); - } - - /** - * Initializes a {@link ContainerClient} object pointing to the specified container. This method does not create a - * container. It simply constructs the URL to the container and offers access to methods relevant to containers. - * - * @param containerName - * The name of the container to point to. - * @return - * A {@link ContainerClient} object pointing to the specified container - */ - public ContainerClient getContainerClient(String containerName) { - try { - return new ContainerClient(this.builder.copyAsContainerBuilder().endpoint(Utility.appendToURLPath(new URL(builder.endpoint()), containerName).toString())); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } - } - - /** - * Returns a lazy loaded list of containers in this account. The returned {@link Iterable} can be iterated - * through while new items are automatically retrieved as needed. For more information, see - * the Azure Docs. - * - * @return - * The list of containers. - */ - public Iterable listContainers() { - return this.listContainers(new ListContainersOptions(), null); - } - - /** - * Returns a lazy loaded list of containers in this account. The returned {@link Iterable} can be iterated - * through while new items are automatically retrieved as needed. For more information, see - * the Azure Docs. - * - * @param options - * A {@link ListContainersOptions} which specifies what data should be returned by the service. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * - * @return - * The list of containers. - */ - public Iterable listContainers(ListContainersOptions options, Duration timeout) { - Flux response = storageAsyncClient.listContainers(options, null); - - return timeout == null ? - response.toIterable(): - response.timeout(timeout).toIterable(); - } - - /** - * Gets the properties of a storage account’s Blob service. For more information, see the - * Azure Docs. - * - * @return - * The storage account properties. - */ - public StorageServiceProperties getProperties() { - return this.getProperties(null, null); - } - - /** - * Gets the properties of a storage account’s Blob service. For more information, see the - * Azure Docs. - * - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * The storage account properties. - */ - public StorageServiceProperties getProperties(Duration timeout, Context context) { - - Mono response = storageAsyncClient.getProperties(context); - - return timeout == null ? - response.block(): - response.block(timeout); - } - - /** - * Sets properties for a storage account's Blob service endpoint. For more information, see the - * Azure Docs. - * Note that setting the default service version has no effect when using this client because this client explicitly - * sets the version header on each request, overriding the default. - * - * @param properties - * Configures the service. - * - * @return - * The storage account properties. - */ - public void setProperties(StorageServiceProperties properties) { - this.setProperties(properties, null, null); - } - - /** - * Sets properties for a storage account's Blob service endpoint. For more information, see the - * Azure Docs. - * Note that setting the default service version has no effect when using this client because this client explicitly - * sets the version header on each request, overriding the default. - * - * @param properties - * Configures the service. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * The storage account properties. - */ - public void setProperties(StorageServiceProperties properties, Duration timeout, Context context) { - Mono response = storageAsyncClient.setProperties(properties, context); - - if (timeout == null) { - response.block(); - } else { - response.block(timeout); - } - } - - /** - * Gets a user delegation key for use with this account's blob storage. - * Note: This method call is only valid when using {@link TokenCredentials} in this object's {@link HttpPipeline}. - * - * @param start - * Start time for the key's validity. Null indicates immediate start. - * @param expiry - * Expiration of the key's validity. - * - * @return - * The user delegation key. - */ - public UserDelegationKey getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry) { - return this.getUserDelegationKey(start, expiry, null, null); - } - - /** - * Gets a user delegation key for use with this account's blob storage. - * Note: This method call is only valid when using {@link TokenCredentials} in this object's {@link HttpPipeline}. - * - * @param start - * Start time for the key's validity. Null indicates immediate start. - * @param expiry - * Expiration of the key's validity. - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * The user delegation key. - */ - public UserDelegationKey getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry, - Duration timeout, Context context) { - Mono response = storageAsyncClient.getUserDelegationKey(start, expiry, context); - - return timeout == null ? - response.block(): - response.block(timeout); - } - - /** - * Retrieves statistics related to replication for the Blob service. It is only available on the secondary - * location endpoint when read-access geo-redundant replication is enabled for the storage account. For more - * information, see the - * Azure Docs. - * - * @return - * The storage account statistics. - */ - public StorageServiceStats getStatistics() { - return this.getStatistics(null, null); - } - - /** - * Retrieves statistics related to replication for the Blob service. It is only available on the secondary - * location endpoint when read-access geo-redundant replication is enabled for the storage account. For more - * information, see the - * Azure Docs. - * - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * The storage account statistics. - */ - public StorageServiceStats getStatistics(Duration timeout, Context context) { - Mono response = storageAsyncClient.getStatistics(context); - - return timeout == null ? - response.block(): - response.block(timeout); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the - * Azure Docs. - * - * @return - * The storage account info. - */ - public StorageAccountInfo getAccountInfo() { - return this.getAccountInfo(null, null); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the - * Azure Docs. - * - * @param timeout - * An optional timeout value beyond which a {@link RuntimeException} will be raised. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return - * The storage account info. - */ - public StorageAccountInfo getAccountInfo(Duration timeout, Context context) { - Mono response = storageAsyncClient.getAccountInfo(context); - - return timeout == null ? - response.block(): - response.block(timeout); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/StorageClientBuilder.java b/storage/client/src/main/java/com/azure/storage/blob/StorageClientBuilder.java deleted file mode 100644 index 0958f8248ce1d..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/StorageClientBuilder.java +++ /dev/null @@ -1,243 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.util.configuration.Configuration; -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLoggingPolicy; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.implementation.util.ImplUtils; -import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * Fluent StorageClientBuilder for instantiating a {@link StorageClient} or {@link StorageAsyncClient}. - * - *

- * An instance of this builder may only be created from static method {@link StorageClient#storageClientBuilder()}. - * The following information must be provided on this builder: - * - *

    - *
  • the endpoint through {@code .endpoint()}, in the format of {@code https://{accountName}.blob.core.windows.net}. - *
  • the credential through {@code .credentials()} or {@code .connectionString()} if the container is not publicly accessible. - *
- * - *

- * Once all the configurations are set on this builder, call {@code .buildClient()} to create a - * {@link StorageClient} or {@code .buildAsyncClient()} to create a {@link StorageAsyncClient}. - */ -public final class StorageClientBuilder { - private static final String ACCOUNT_NAME = "AccountName".toLowerCase(); - private static final String ACCOUNT_KEY = "AccountKey".toLowerCase(); - - private final List policies; - - private URL endpoint; - private ICredentials credentials = new AnonymousCredentials(); - private HttpClient httpClient; - private HttpLogDetailLevel logLevel; - private RetryPolicy retryPolicy; - private Configuration configuration; - - public StorageClientBuilder() { - retryPolicy = new RetryPolicy(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); - } - - private StorageClientBuilder(List policies, URL endpoint, ICredentials credentials, - HttpClient httpClient, HttpLogDetailLevel logLevel, RetryPolicy retryPolicy, Configuration configuration) { - this.policies = policies; - this.endpoint = endpoint; - this.credentials = credentials; - this.httpClient = httpClient; - this.logLevel = logLevel; - this.retryPolicy = retryPolicy; - this.configuration = configuration; - } - - StorageClientBuilder copyBuilder() { - return new StorageClientBuilder(this.policies, this.endpoint, this.credentials, this.httpClient, this.logLevel, this.retryPolicy, this.configuration); - } - - ContainerClientBuilder copyAsContainerBuilder() { - return new ContainerClientBuilder(this.policies, this.endpoint, this.credentials, this.httpClient, this.logLevel, this.retryPolicy, this.configuration); - } - - /** - * Constructs an instance of ContainerAsyncClient based on the configurations stored in the appendBlobClientBuilder. - * @return a new client instance - */ - AzureBlobStorageImpl buildImpl() { - Objects.requireNonNull(endpoint); - - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - policies.add(new UserAgentPolicy(BlobConfiguration.NAME, BlobConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - policies.add(credentials); // This needs to be a different credential type. - - policies.add(retryPolicy); - - policies.addAll(this.policies); - policies.add(new HttpLoggingPolicy(logLevel)); - - HttpPipeline pipeline = HttpPipeline.builder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); - - return new AzureBlobStorageBuilder() - .url(endpoint.toString()) - .pipeline(pipeline) - .build(); - } - - /** - * @return a {@link StorageClient} created from the configurations in this builder. - */ - public StorageClient buildClient() { - return new StorageClient(this); - } - - /** - * @return a {@link StorageAsyncClient} created from the configurations in this builder. - */ - public StorageAsyncClient buildAsyncClient() { - return new StorageAsyncClient(this); - } - - /** - * Sets the blob service endpoint, additionally parses it for information (SAS token, queue name) - * @param endpoint URL of the service - * @return the updated StorageClientBuilder object - */ - public StorageClientBuilder endpoint(String endpoint) { - Objects.requireNonNull(endpoint); - try { - this.endpoint = new URL(endpoint); - } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage Queue endpoint url is malformed."); - } - - return this; - } - - String endpoint() { - return this.endpoint.toString(); - } - - /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials - * @return the updated ContainerClientBuilder object - */ - public StorageClientBuilder credentials(SharedKeyCredentials credentials) { - this.credentials = credentials; - return this; - } - - /** - * Sets the credentials used to authorize requests sent to the service - * @param credentials authorization credentials - * @return the updated StorageClientBuilder object - */ - public StorageClientBuilder credentials(TokenCredentials credentials) { - this.credentials = credentials; - return this; - } - - /** - * Clears the credentials used to authorize requests sent to the service - * @return the updated StorageClientBuilder object - */ - public StorageClientBuilder anonymousCredentials() { - this.credentials = new AnonymousCredentials(); - return this; - } - - /** - * Sets the connection string for the service, parses it for authentication information (account name, account key) - * @param connectionString connection string from access keys section - * @return the updated StorageClientBuilder object - */ - public StorageClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - - Map connectionKVPs = new HashMap<>(); - for (String s : connectionString.split(";")) { - String[] kvp = s.split("=", 2); - connectionKVPs.put(kvp[0].toLowerCase(), kvp[1]); - } - - String accountName = connectionKVPs.get(ACCOUNT_NAME); - String accountKey = connectionKVPs.get(ACCOUNT_KEY); - - if (ImplUtils.isNullOrEmpty(accountName) || ImplUtils.isNullOrEmpty(accountKey)) { - throw new IllegalArgumentException("Connection string must contain 'AccountName' and 'AccountKey'."); - } - - // Use accountName and accountKey to get the SAS token using the credential class. - credentials = new SharedKeyCredentials(accountName, accountKey); - - return this; - } - - /** - * Sets the http client used to send service requests - * @param httpClient http client to send requests - * @return the updated StorageClientBuilder object - */ - public StorageClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /** - * Adds a pipeline policy to apply on each request sent - * @param pipelinePolicy a pipeline policy - * @return the updated StorageClientBuilder object - */ - public StorageClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - this.policies.add(pipelinePolicy); - return this; - } - - /** - * Sets the logging level for service requests - * @param logLevel logging level - * @return the updated StorageClientBuilder object - */ - public StorageClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { - this.logLevel = logLevel; - return this; - } - - /** - * Sets the configuration object used to retrieve environment configuration values used to buildClient the client with - * when they are not set in the appendBlobClientBuilder, defaults to Configuration.NONE - * @param configuration configuration store - * @return the updated StorageClientBuilder object - */ - public StorageClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/StorageException.java b/storage/client/src/main/java/com/azure/storage/blob/StorageException.java deleted file mode 100644 index 6d794a2a604da..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/StorageException.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.exception.HttpResponseException; -import com.azure.storage.blob.models.StorageErrorCode; -import com.azure.storage.blob.models.StorageErrorException; -import reactor.core.publisher.Mono; - -/** - * A {@code StorageException} is thrown whenever Azure Storage successfully returns an error code that is not 200-level. - * Users can inspect the status code and error code to determine the cause of the error response. The exception message - * may also contain more detailed information depending on the type of error. The user may also inspect the raw HTTP - * response or call toString to get the full payload of the error response if present. - * Note that even some expected "errors" will be thrown as a {@code StorageException}. For example, some users may - * perform a getProperties request on an entity to determine whether it exists or not. If it does not exists, an - * exception will be thrown even though this may be considered an expected indication of absence in this case. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=exception "Sample code for StorageExceptions")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ -public final class StorageException extends HttpResponseException { - - private final String message; - - StorageException(StorageErrorException e, String responseBody) { - super(e.getMessage(), e.response(), e); - this.message = responseBody; - } - - /** - * @return The error code returned by the service. - */ - public StorageErrorCode errorCode() { - return StorageErrorCode.fromString(super.response().headers().value(Constants.HeaderConstants.ERROR_CODE)); - } - - /** - * @return The message returned by the service. - */ - public String message() { - return this.message; - } - - /** - * @return The status code on the response. - */ - public int statusCode() { - return super.response().statusCode(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/StorageRawClient.java b/storage/client/src/main/java/com/azure/storage/blob/StorageRawClient.java deleted file mode 100644 index 2fae8cc690b64..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/StorageRawClient.java +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.util.Context; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.ServicesGetAccountInfoResponse; -import com.azure.storage.blob.models.ServicesGetPropertiesResponse; -import com.azure.storage.blob.models.ServicesGetStatisticsResponse; -import com.azure.storage.blob.models.ServicesGetUserDelegationKeyResponse; -import com.azure.storage.blob.models.ServicesListContainersSegmentResponse; -import com.azure.storage.blob.models.ServicesSetPropertiesResponse; -import com.azure.storage.blob.models.StorageServiceProperties; -import reactor.core.publisher.Mono; - -import java.time.Duration; -import java.time.OffsetDateTime; - -/** - * Represents a URL to a storage service. This class does not hold any state about a particular storage account but is - * instead a convenient way of sending off appropriate requests to the resource on the service. - * It may also be used to construct URLs to blobs and containers. - * Please see here for more - * information on containers. - */ -final class StorageRawClient { - - StorageAsyncRawClient storageAsyncRawClient; - - /** - * Creates a {@code ServiceURL} object pointing to the account specified by the URL and using the provided pipeline - * to make HTTP requests. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_url "Sample code for ServiceURL constructor")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public StorageRawClient(AzureBlobStorageImpl azureBlobStorage) { - this.storageAsyncRawClient = new StorageAsyncRawClient(azureBlobStorage); - } - - /** - * Returns a Mono segment of containers starting from the specified Marker. - * Use an empty marker to start enumeration from the beginning. Container names are returned in lexicographic order. - * After getting a segment, process it, and then call ListContainers again (passing the the previously-returned - * Marker) to get the next segment. For more information, see - * the Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListContainersSegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param options - * A {@link ListContainersOptions} which specifies what data should be returned by the service. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_list "Sample code for ServiceURL.listContainersSegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_list_helper "Helper code for ServiceURL.listContainersSegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ServicesListContainersSegmentResponse listContainersSegment(String marker, - ListContainersOptions options) { - return this.listContainersSegment(marker, options,null, null); - } - - /** - * Returns a Mono segment of containers starting from the specified Marker. - * Use an empty marker to start enumeration from the beginning. Container names are returned in lexicographic order. - * After getting a segment, process it, and then call ListContainers again (passing the the previously-returned - * Marker) to get the next segment. For more information, see - * the Azure Docs. - * - * @param marker - * Identifies the portion of the list to be returned with the next list operation. - * This value is returned in the response of a previous list operation as the - * ListContainersSegmentResponse.body().nextMarker(). Set to null to list the first segment. - * @param options - * A {@link ListContainersOptions} which specifies what data should be returned by the service. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_list "Sample code for ServiceURL.listContainersSegment")] \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_list_helper "Helper code for ServiceURL.listContainersSegment")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ServicesListContainersSegmentResponse listContainersSegment(String marker, - ListContainersOptions options, Duration timeout, Context context) { - Mono response = storageAsyncRawClient.listContainersSegment(marker, options, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Gets the properties of a storage account’s Blob service. For more information, see the - * Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_getsetprops "Sample code for ServiceURL.getProperties")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ServicesGetPropertiesResponse getProperties() { - return this.getProperties(null, null); - } - - /** - * Gets the properties of a storage account’s Blob service. For more information, see the - * Azure Docs. - * - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_getsetprops "Sample code for ServiceURL.getProperties")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ServicesGetPropertiesResponse getProperties(Duration timeout, Context context) { - Mono response = storageAsyncRawClient.getProperties(context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Sets properties for a storage account's Blob service endpoint. For more information, see the - * Azure Docs. - * Note that setting the default service version has no effect when using this client because this client explicitly - * sets the version header on each request, overriding the default. - * - * @param properties - * Configures the service. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_getsetprops "Sample code for ServiceURL.setProperties")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ServicesSetPropertiesResponse setProperties(StorageServiceProperties properties) { - return this.setProperties(properties, null, null); - } - - /** - * Sets properties for a storage account's Blob service endpoint. For more information, see the - * Azure Docs. - * Note that setting the default service version has no effect when using this client because this client explicitly - * sets the version header on each request, overriding the default. - * - * @param properties - * Configures the service. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_getsetprops "Sample code for ServiceURL.setProperties")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ServicesSetPropertiesResponse setProperties(StorageServiceProperties properties, Duration timeout, Context context) { - Mono response = storageAsyncRawClient.setProperties(properties, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Gets a user delegation key for use with this account's blob storage. - * Note: This method call is only valid when using {@link TokenCredentials} in this object's {@link HttpPipeline}. - * - * @param start - * Start time for the key's validity. Null indicates immediate start. - * @param expiry - * Expiration of the key's validity. - * - * @return Emits the successful response. - */ - public ServicesGetUserDelegationKeyResponse getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry) { - return this.getUserDelegationKey(start, expiry, null, null); - } - - /** - * Gets a user delegation key for use with this account's blob storage. - * Note: This method call is only valid when using {@link TokenCredentials} in this object's {@link HttpPipeline}. - * - * @param start - * Start time for the key's validity. Null indicates immediate start. - * @param expiry - * Expiration of the key's validity. - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - */ - public ServicesGetUserDelegationKeyResponse getUserDelegationKey(OffsetDateTime start, OffsetDateTime expiry, - Duration timeout, Context context) { - Mono response = storageAsyncRawClient.getUserDelegationKey(start, expiry, context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Retrieves statistics related to replication for the Blob service. It is only available on the secondary - * location endpoint when read-access geo-redundant replication is enabled for the storage account. For more - * information, see the - * Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_stats "Sample code for ServiceURL.getStats")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ServicesGetStatisticsResponse getStatistics() { - return this.getStatistics(null, null); - } - - /** - * Retrieves statistics related to replication for the Blob service. It is only available on the secondary - * location endpoint when read-access geo-redundant replication is enabled for the storage account. For more - * information, see the - * Azure Docs. - * - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_stats "Sample code for ServiceURL.getStats")] \n - * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ServicesGetStatisticsResponse getStatistics(Duration timeout, Context context) { - Mono response = storageAsyncRawClient.getStatistics(context); - return timeout == null - ? response.block() - : response.block(timeout); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the - * Azure Docs. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=account_info "Sample code for ServiceURL.getAccountInfo")] \n - * For more samples, please see the [Samples file] (https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ServicesGetAccountInfoResponse getAccountInfo() { - return this.getAccountInfo(null, null); - } - - /** - * Returns the sku name and account kind for the account. For more information, please see the - * Azure Docs. - * - * @param context - * {@code Context} offers a means of passing arbitrary data (key/value pairs) to an - * {@link HttpPipeline}'s policy objects. Most applications do not need to pass - * arbitrary data to the pipeline and can pass {@code Context.NONE} or {@code null}. Each context object is - * immutable. The {@code withContext} with data method creates a new {@code Context} object that refers to - * its parent, forming a linked list. - * - * @return Emits the successful response. - * - * @apiNote ## Sample Code \n - * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=account_info "Sample code for ServiceURL.getAccountInfo")] \n - * For more samples, please see the [Samples file] (https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) - */ - public ServicesGetAccountInfoResponse getAccountInfo(Duration timeout, Context context) { - Mono response = storageAsyncRawClient.getAccountInfo(context); - return timeout == null - ? response.block() - : response.block(timeout); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/StorageURL.java b/storage/client/src/main/java/com/azure/storage/blob/StorageURL.java deleted file mode 100644 index 89213e91d2287..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/StorageURL.java +++ /dev/null @@ -1,154 +0,0 @@ -//// Copyright (c) Microsoft Corporation. All rights reserved. -//// Licensed under the MIT License. -// -//package com.azure.storage.blob; -// -//import com.azure.core.http.HttpPipeline; -//import com.azure.core.implementation.http.UrlBuilder; -//import com.microsoft.rest.v2.http.HttpPipeline; -//import com.microsoft.rest.v2.http.HttpPipelineOptions; -//import com.microsoft.rest.v2.http.UrlBuilder; -//import com.microsoft.rest.v2.policy.DecodingPolicyFactory; -//import com.microsoft.rest.v2.policy.RequestPolicyFactory; -// -//import java.net.MalformedURLException; -//import java.net.URL; -//import java.util.ArrayList; -// -///** -// * Represents a URL to a Azure storage object. Typically this class is only needed to generate a new pipeline. In most -// * cases, one of the other URL types will be more useful. -// */ -//public abstract class StorageURL { -// -// protected final GeneratedStorageClient storageClient; -// -// protected StorageURL(URL url, HttpPipeline pipeline) { -// if (url == null) { -// throw new IllegalArgumentException("url cannot be null."); -// } -// if (pipeline == null) { -// throw new IllegalArgumentException("Pipeline cannot be null. Create a pipeline by calling" -// + " StorageURL.createPipeline."); -// } -// -// this.storageClient = new GeneratedStorageClient(pipeline) -// .withVersion(Constants.HeaderConstants.TARGET_STORAGE_VERSION); -// this.storageClient.withUrl(url.toString()); -// } -// -// -// -// /** -// * Creates an pipeline to process the HTTP requests and Responses. -// * -// * @apiNote -// * ## Sample Code \n -// * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_url "Sample code for StorageURL.createPipeline")] \n -// * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/New-Storage-SDK-V10-Preview/src/test/java/com/microsoft/azure/storage/Samples.java) -// * -// * @return The pipeline. -// */ -// public static HttpPipeline createPipeline() { -// return createPipeline(new AnonymousCredentials(), new PipelineOptions()); -// } -// -// /** -// * Creates an pipeline to process the HTTP requests and Responses. -// * -// * @apiNote -// * ## Sample Code \n -// * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_url "Sample code for StorageURL.createPipeline")] \n -// * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/New-Storage-SDK-V10-Preview/src/test/java/com/microsoft/azure/storage/Samples.java) -// * -// * @param credentials -// * The credentials the pipeline will use to authenticate the requests. -// * -// * @return The pipeline. -// */ -// public static HttpPipeline createPipeline(ICredentials credentials) { -// return createPipeline(credentials, new PipelineOptions()); -// } -// -// /** -// * Creates an pipeline to process the HTTP requests and Responses. -// * -// * @apiNote -// * ## Sample Code \n -// * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_url "Sample code for StorageURL.createPipeline")] \n -// * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/New-Storage-SDK-V10-Preview/src/test/java/com/microsoft/azure/storage/Samples.java) -// * -// * @param pipelineOptions -// * Configurations for each policy in the pipeline. -// * @return The pipeline. -// */ -// public static HttpPipeline createPipeline(PipelineOptions pipelineOptions) { -// return createPipeline(new AnonymousCredentials(), pipelineOptions); -// } -// -// /** -// * Creates an pipeline to process the HTTP requests and Responses. -// * -// * @apiNote -// * ## Sample Code \n -// * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_url "Sample code for StorageURL.createPipeline")] \n -// * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/New-Storage-SDK-V10-Preview/src/test/java/com/microsoft/azure/storage/Samples.java) -// * -// * @param credentials -// * The credentials the pipeline will use to authenticate the requests. -// * @param pipelineOptions -// * Configurations for each policy in the pipeline. -// * -// * @return The pipeline. -// * -// * @apiNote ## Sample Code \n -// * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=service_url "Sample code for StorageURL.createPipeline")] \n -// * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) -// */ -// public static HttpPipeline createPipeline(ICredentials credentials, PipelineOptions pipelineOptions) { -// /* -// PipelineOptions is mutable, but its fields refer to immutable objects. This method can pass the fields to other -// methods, but the PipelineOptions object itself can only be used for the duration of this call; it must not be -// passed to anything with a longer lifetime. -// */ -// if (credentials == null) { -// throw new IllegalArgumentException( -// "Credentials cannot be null. For anonymous access use Anonymous Credentials."); -// } -// if (pipelineOptions == null) { -// throw new IllegalArgumentException("pipelineOptions cannot be null. You must at least specify a client."); -// } -// -// // Closest to API goes first, closest to wire goes last. -// ArrayList factories = new ArrayList<>(); -// factories.add(new TelemetryPolicy(pipelineOptions.telemetryOptions())); -// factories.add(new RequestIDPolicy()); -// factories.add(new RequestRetryPolicy(pipelineOptions.requestRetryOptions())); -// if (!(credentials instanceof AnonymousCredentials)) { -// factories.add(credentials); -// } -// factories.add(new SetResponseFieldPolicy()); -// factories.add(new DecodingPolicyFactory()); -// factories.add(new LoggingPolicy(pipelineOptions.loggingOptions())); -// -// return HttpPipeline.build(new HttpPipelineOptions().withHttpClient(pipelineOptions.client()) -// .withLogger(pipelineOptions.logger()), -// factories.toArray(new RequestPolicyFactory[factories.size()])); -// } -// -// @Override -// public String toString() { -// return this.storageClient.url(); -// } -// -// /** -// * @return The underlying url to the resource. -// */ -// public URL toURL() { -// try { -// return new URL(this.storageClient.url()); -// } catch (MalformedURLException e) { -// throw new RuntimeException(e); -// } -// } -//} diff --git a/storage/client/src/main/java/com/azure/storage/blob/TelemetryOptions.java b/storage/client/src/main/java/com/azure/storage/blob/TelemetryOptions.java deleted file mode 100644 index 36f18a99a231c..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/TelemetryOptions.java +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -/** - * Options for configuring the {@link TelemetryPolicy}. Please refer to the Factory for more information. - */ -final class TelemetryOptions { - - private final String userAgentPrefix; - - public TelemetryOptions() { - this(Constants.EMPTY_STRING); - } - - /** - * @param userAgentPrefix - * A string prepended to each request's User-Agent and sent to the service. The service records. - * the user-agent in logs for diagnostics and tracking of client requests. - */ - public TelemetryOptions(String userAgentPrefix) { - this.userAgentPrefix = userAgentPrefix; - } - - /** - * @return The user agent prefix. - */ - public String userAgentPrefix() { - return this.userAgentPrefix; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/TelemetryPolicy.java b/storage/client/src/main/java/com/azure/storage/blob/TelemetryPolicy.java deleted file mode 100644 index 754e1f67c3b5e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/TelemetryPolicy.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipelineCallContext; -import com.azure.core.http.HttpPipelineNextPolicy; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.policy.HttpPipelinePolicy; -import reactor.core.publisher.Mono; - -import java.util.Locale; - -/** - * This is a factory which creates policies in an {@link com.azure.core.http.HttpPipeline} for adding telemetry to a - * given HTTP request. In most cases, it is sufficient to configure a {@link TelemetryOptions} object and set those as - * a field on a {@link PipelineOptions} object to configure a default pipeline. The factory and policy must only be used - * directly when creating a custom pipeline. - */ -final class TelemetryPolicy implements HttpPipelinePolicy { - - private final String userAgent; - - /** - * Creates a factory that can create telemetry policy objects which add telemetry information to the outgoing - * HTTP requests. - * - * @param telemetryOptions - * {@link TelemetryOptions} - */ - public TelemetryPolicy(TelemetryOptions telemetryOptions) { - telemetryOptions = telemetryOptions == null ? new TelemetryOptions() : telemetryOptions; - String userAgentPrefix = telemetryOptions.userAgentPrefix() == null - ? Constants.EMPTY_STRING : telemetryOptions.userAgentPrefix(); - this.userAgent = userAgentPrefix + ' ' - + Constants.HeaderConstants.USER_AGENT_PREFIX + '/' + Constants.HeaderConstants.USER_AGENT_VERSION - + String.format(Locale.ROOT, " (JavaJRE %s; %s %s)", - System.getProperty("java.version"), - System.getProperty("os.name").replaceAll(" ", ""), - System.getProperty("os.version")); - } - - @Override - public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - context.httpRequest().headers().put(Constants.HeaderConstants.USER_AGENT, userAgent); - return next.process(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/TokenCredentials.java b/storage/client/src/main/java/com/azure/storage/blob/TokenCredentials.java deleted file mode 100644 index d584fd79a27d9..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/TokenCredentials.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpPipelineCallContext; -import com.azure.core.http.HttpPipelineNextPolicy; -import com.azure.core.http.HttpResponse; -import reactor.core.publisher.Mono; - -import java.util.concurrent.atomic.AtomicReference; - -/** - * TokenCredentials are a means of authenticating requests to Azure Storage via OAuth user tokens. This is the preferred - * way of authenticating with Azure Storage. - */ -public final class TokenCredentials implements ICredentials { - - /* - This is an atomic reference because it must be thread safe as all parts of the pipeline must be. It however cannot - be final as most factory fields are because in order to actually be useful, the token has to be renewed every few - hours, which requires updating the value here. - */ - private AtomicReference token; - - /** - * Creates a token credential for use with role-based access control (RBAC) access to Azure Storage resources. - * - * @param token - * A {@code String} of the token to use for authentication. - */ - public TokenCredentials(String token) { - this.token = new AtomicReference<>(token); - } - - /** - * Retrieve the value of the token used by this factory. - * - * @return A {@code String} with the token's value. - */ - public String getToken() { - return this.token.get(); - } - - /** - * Update the token to a new value. - * - * @param token - * A {@code String} containing the new token's value. - */ - public void withToken(String token) { - this.token.set(token); - } - - - @Override - public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - if (!context.httpRequest().url().getProtocol().equals(Constants.HTTPS)) { - throw new Error("Token credentials require a URL using the https protocol scheme"); - } - context.httpRequest().header(Constants.HeaderConstants.AUTHORIZATION, - "Bearer " + this.getToken()); - return next.process(); - } - -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/TransferManager.java b/storage/client/src/main/java/com/azure/storage/blob/TransferManager.java deleted file mode 100644 index 65b43c91eca58..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/TransferManager.java +++ /dev/null @@ -1,481 +0,0 @@ -//// Copyright (c) Microsoft Corporation. All rights reserved. -//// Licensed under the MIT License. -// -//package com.azure.storage.blob; -// -//import java.io.IOException; -//import java.nio.ByteBuffer; -//import java.nio.channels.AsynchronousFileChannel; -//import java.util.ArrayList; -//import java.util.Base64; -//import java.util.List; -//import java.util.UUID; -//import java.util.concurrent.atomic.AtomicLong; -//import java.util.concurrent.locks.Lock; -//import java.util.concurrent.locks.ReentrantLock; -// -//import static java.lang.StrictMath.toIntExact; -//import static java.nio.charset.StandardCharsets.UTF_8; -// -///** -// * This class contains a collection of methods (and structures associated with those methods) which perform higher-level -// * operations. Whereas operations on the URL types guarantee a single REST request and make no assumptions on desired -// * behavior, these methods will often compose several requests to provide a convenient way of performing more complex -// * operations. Further, we will make our own assumptions and optimizations for common cases that may not be ideal for -// * rarer cases. -// */ -//public final class TransferManager { -// -// /** -// * The default size of a download chunk for download large blobs. -// */ -// public static final int BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE = 4 * Constants.MB; -// -// /** -// * Uploads the contents of a file to a block blob in parallel, breaking it into block-size chunks if necessary. -// * -// * @param file -// * The file to upload. -// * @param blockBlobURL -// * Points to the blob to which the data should be uploaded. -// * @param blockLength -// * If the data must be broken up into blocks, this value determines what size those blocks will be. This -// * will affect the total number of service requests made as each REST request uploads exactly one block in -// * full. This value will be ignored if the data can be uploaded in a single put-blob operation. Must be -// * between 1 and {@link BlockBlobURL#MAX_STAGE_BLOCK_BYTES}. Note as well that -// * {@code fileLength/blockLength} must be less than or equal to {@link BlockBlobURL#MAX_BLOCKS}. -// * @param maxSingleShotSize -// * If the size of the data is less than or equal to this value, it will be uploaded in a single put -// * rather than broken up into chunks. If the data is uploaded in a single shot, the block size will be -// * ignored. Some constraints to consider are that more requests cost more, but several small or mid-sized -// * requests may sometimes perform better. Must be greater than 0. May be null to accept default behavior. -// * @param options -// * {@link TransferManagerUploadToBlockBlobOptions} -// * -// * @return Emits the successful response. -// * -// * @apiNote ## Sample Code \n -// * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=tm_file "Sample code for TransferManager.uploadFileToBlockBlob")] \n -// * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) -// */ -// public static Single uploadFileToBlockBlob(final AsynchronousFileChannel file, -// final BlockBlobURL blockBlobURL, final int blockLength, Integer maxSingleShotSize, -// final TransferManagerUploadToBlockBlobOptions options) throws IOException { -// Utility.assertNotNull("file", file); -// Utility.assertNotNull("blockBlobURL", blockBlobURL); -// Utility.assertInBounds("blockLength", blockLength, 1, BlockBlobURL.MAX_STAGE_BLOCK_BYTES); -// if (maxSingleShotSize != null) { -// Utility.assertInBounds("maxSingleShotSize", maxSingleShotSize, 0, BlockBlobURL.MAX_UPLOAD_BLOB_BYTES); -// } else { -// maxSingleShotSize = BlockBlobURL.MAX_UPLOAD_BLOB_BYTES; -// } -// TransferManagerUploadToBlockBlobOptions optionsReal = options == null -// ? new TransferManagerUploadToBlockBlobOptions() : options; -// -// // See ProgressReporter for an explanation on why this lock is necessary and why we use AtomicLong. -// AtomicLong totalProgress = new AtomicLong(0); -// Lock progressLock = new ReentrantLock(); -// -// // If the size of the file can fit in a single upload, do it this way. -// if (file.size() < maxSingleShotSize) { -// Flowable data = FlowableUtil.readFile(file); -// -// data = ProgressReporter.addProgressReporting(data, optionsReal.progressReceiver()); -// -// return blockBlobURL.upload(data, file.size(), optionsReal.httpHeaders(), -// optionsReal.metadata(), optionsReal.accessConditions(), null) -// // Transform the specific RestResponse into a CommonRestResponse. -// .map(CommonRestResponse::createFromPutBlobResponse); -// } -// -// // Calculate and validate the number of blocks. -// int numBlocks = calculateNumBlocks(file.size(), blockLength); -// if (numBlocks > BlockBlobURL.MAX_BLOCKS) { -// throw new IllegalArgumentException(SR.BLOB_OVER_MAX_BLOCK_LIMIT); -// } -// -// return Observable.range(0, numBlocks) -// /* -// For each block, make a call to stageBlock as follows. concatMap ensures that the items emitted -// by this Observable are in the same sequence as they are begun, which will be important for composing -// the list of Ids later. Eager ensures parallelism but may require some internal buffering. -// */ -// .concatMapEager(i -> { -// // The max number of bytes for a block is currently 100MB, so the final result must be an int. -// int count = (int) Math.min((long) blockLength, (file.size() - i * (long) blockLength)); -// // i * blockLength could be a long, so we need a cast to prevent overflow. -// Flowable data = FlowableUtil.readFile(file, i * (long) blockLength, count); -// -// // Report progress as necessary. -// data = ProgressReporter.addParallelProgressReporting(data, optionsReal.progressReceiver(), -// progressLock, totalProgress); -// -// final String blockId = Base64.getEncoder().encodeToString( -// UUID.randomUUID().toString().getBytes(UTF_8)); -// -// /* -// Make a call to stageBlock. Instead of emitting the response, which we don't care about other -// than that it was successful, emit the blockId for this request. These will be collected below. -// Turn that into an Observable which emits one item to comply with the signature of -// concatMapEager. -// */ -// return blockBlobURL.stageBlock(blockId, data, -// count, optionsReal.accessConditions().leaseAccessConditions(), null) -// .map(x -> blockId).toObservable(); -// -// /* -// Specify the number of concurrent subscribers to this map. This determines how many concurrent -// rest calls are made. This is so because maxConcurrency is the number of internal subscribers -// available to subscribe to the Observables emitted by the source. A subscriber is not released -// for a new subscription until its Observable calls onComplete, which here means that the call to -// stageBlock is finished. Prefetch is a hint that each of the Observables emitted by the source -// will emit only one value, which is true here because we have converted from a Single. -// */ -// }, optionsReal.parallelism(), 1) -// /* -// collectInto will gather each of the emitted blockIds into a list. Because we used concatMap, the Ids -// will be emitted according to their block number, which means the list generated here will be -// properly ordered. This also converts into a Single. -// */ -// .collectInto(new ArrayList(numBlocks), ArrayList::add) -// /* -// collectInto will not emit the list until its source calls onComplete. This means that by the time we -// call stageBlock list, all of the stageBlock calls will have finished. By flatMapping the list, we -// can "map" it into a call to commitBlockList. -// */ -// .flatMap(ids -> -// blockBlobURL.commitBlockList(ids, optionsReal.httpHeaders(), optionsReal.metadata(), -// optionsReal.accessConditions(), null)) -// -// // Finally, we must turn the specific response type into a CommonRestResponse by mapping. -// .map(CommonRestResponse::createFromPutBlockListResponse); -// } -// -// private static int calculateNumBlocks(long dataSize, long blockLength) { -// // Can successfully cast to an int because MaxBlockSize is an int, which this expression must be less than. -// int numBlocks = toIntExact(dataSize / blockLength); -// // Include an extra block for trailing data. -// if (dataSize % blockLength != 0) { -// numBlocks++; -// } -// return numBlocks; -// } -// -// /** -// * Downloads a file directly into a file, splitting the download into chunks and parallelizing as necessary. -// * -// * @param file -// * The destination file to which the blob will be written. -// * @param blobURL -// * The URL to the blob to download. -// * @param range -// * {@link BlobRange} -// * @param options -// * {@link TransferManagerDownloadFromBlobOptions} -// * -// * @return A {@code Completable} that will signal when the download is complete. -// * -// * @apiNote ## Sample Code \n -// * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=tm_file "Sample code for TransferManager.downloadBlobToFile")] \n -// * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) -// */ -// public static Single downloadBlobToFile(AsynchronousFileChannel file, BlobURL blobURL, -// BlobRange range, TransferManagerDownloadFromBlobOptions options) { -// BlobRange rangeReal = range == null ? new BlobRange() : range; -// TransferManagerDownloadFromBlobOptions optionsReal = options == null ? new TransferManagerDownloadFromBlobOptions() : options; -// Utility.assertNotNull("blobURL", blobURL); -// Utility.assertNotNull("file", file); -// -// // See ProgressReporter for an explanation on why this lock is necessary and why we use AtomicLong. -// Lock progressLock = new ReentrantLock(); -// AtomicLong totalProgress = new AtomicLong(0); -// -// // Get the size of the data and etag if not specified by the user. -// Single setupSingle = getSetupSingle(blobURL, rangeReal, optionsReal); -// -// return setupSingle.flatMap(helper -> { -// long newCount = helper.newCount; -// BlobAccessConditions realConditions = helper.realConditions; -// -// int numChunks = calculateNumBlocks(newCount, optionsReal.chunkSize()); -// -// // In case it is an empty blob, this ensures we still actually perform a download operation. -// numChunks = numChunks == 0 ? 1 : numChunks; -// -// DownloadAsyncResponse initialResponse = helper.initialResponse; -// return Flowable.range(0, numChunks) -// .flatMapSingle(chunkNum -> { -// // The first chunk was retrieved during setup. -// if (chunkNum == 0) { -// return writeBodyToFile(initialResponse, file, 0, optionsReal, progressLock, totalProgress); -// } -// -// // Calculate whether we need a full chunk or something smaller because we are at the end. -// long chunkSizeActual = Math.min(optionsReal.chunkSize(), -// newCount - (chunkNum * optionsReal.chunkSize())); -// BlobRange chunkRange = new BlobRange().withOffset( -// rangeReal.offset() + (chunkNum * optionsReal.chunkSize())) -// .withCount(chunkSizeActual); -// -// // Make the download call. -// return blobURL.download(chunkRange, realConditions, false, null) -// .flatMap(response -> -// writeBodyToFile(response, file, chunkNum, optionsReal, progressLock, -// totalProgress)); -// }, false, optionsReal.parallelism()) -// // All the headers will be the same, so we just pick the last one. -// .lastOrError(); -// }); -// } -// -// /* -// Construct a Single which will emit the total count for calculating the number of chunks, access conditions -// containing the etag to lock on, and the response from downloading the first chunk. -// */ -// private static Single getSetupSingle(BlobURL blobURL, BlobRange r, -// TransferManagerDownloadFromBlobOptions o) { -// // We will scope our initial download to either be one chunk or the total size. -// long initialChunkSize = r.count() != null && r.count() < o.chunkSize() ? r.count() : o.chunkSize(); -// -// return blobURL.download(new BlobRange().withOffset(r.offset()).withCount(initialChunkSize), -// o.accessConditions(), false, null) -// .map(response -> { -// /* -// Either the etag was set and it matches because the download succeed, so this is a no-op, or there -// was no etag, so we set it here. -// */ -// BlobAccessConditions newConditions = setEtag(o.accessConditions(), response.headers().eTag()); -// -// /* -// If the user either didn't specify a count or they specified a count greater than the size of the -// remaining data, take the size of the remaining data. This is to prevent the case where the count -// is much much larger than the size of the blob and we could try to download at an invalid offset. -// */ -// long newCount; -// // Extract the total length of the blob from the contentRange header. e.g. "bytes 1-6/7" -// long totalLength = extractTotalBlobLength(response.headers().contentRange()); -// if (r.count() == null || r.count() > (totalLength - r.offset())) { -// newCount = totalLength - r.offset(); -// } else { -// newCount = r.count(); -// } -// return new DownloadHelper(newCount, newConditions, response); -// }) -// .onErrorResumeNext(throwable -> { -// /* -// In the case of an empty blob, we still want to report successful download to file and give back -// valid DownloadResponseHeaders. Attempting a range download on an empty blob will return an -// InvalidRange error code and a Content-Range header of the format "bytes * /0". -// We need to double check that the total size is zero in the case that the customer has attempted an -// invalid range on a non-zero length blob. -// */ -// if (throwable instanceof StorageException -// && ((StorageException) throwable).errorCode() == StorageErrorCode.INVALID_RANGE -// && extractTotalBlobLength(((StorageException) throwable).response() -// .headers().value("Content-Range")) == 0) { -// return blobURL.download(new BlobRange().withOffset(0).withCount(0L), o.accessConditions(), -// false, null) -// .map(response -> { -// /* -// Ensure the blob is still 0 length by checking our download was the full length. -// (200 is for full blob; 206 is partial). -// */ -// if (response.statusCode() != 200) { -// throw new IllegalStateException("Blob was modified mid download. It was " -// + "originally 0 bytes and is now larger."); -// } -// return new DownloadHelper(0L, o.accessConditions(), response); -// }); -// } -// return Single.error(throwable); -// }); -// } -// -// private static BlobAccessConditions setEtag(BlobAccessConditions accessConditions, String etag) { -// /* -// We don't want to modify the user's object, so we'll create a duplicate and set the -// retrieved etag. -// */ -// return new BlobAccessConditions() -// .withModifiedAccessConditions(new ModifiedAccessConditions() -// .withIfModifiedSince( -// accessConditions.modifiedAccessConditions().ifModifiedSince()) -// .withIfUnmodifiedSince( -// accessConditions.modifiedAccessConditions().ifUnmodifiedSince()) -// .withIfMatch(etag) -// .withIfNoneMatch( -// accessConditions.modifiedAccessConditions().ifNoneMatch())) -// .withLeaseAccessConditions(accessConditions.leaseAccessConditions()); -// } -// -// private static Single writeBodyToFile(DownloadAsyncResponse response, -// AsynchronousFileChannel file, long chunkNum, TransferManagerDownloadFromBlobOptions optionsReal, -// Lock progressLock, AtomicLong totalProgress) { -// -// // Extract the body. -// Flowable data = response.body( -// optionsReal.reliableDownloadOptionsPerBlock()); -// -// // Report progress as necessary. -// data = ProgressReporter.addParallelProgressReporting(data, -// optionsReal.progressReceiver(), progressLock, totalProgress); -// -// // Write to the file. -// return FlowableUtil.writeFile(data, file, -// chunkNum * optionsReal.chunkSize()) -// /* -// Satisfy the return type. Observable required for flatmap to accept -// maxConcurrency. We want to eventually give the user back the headers. -// */ -// .andThen(Single.just(response.headers())); -// } -// -// private static long extractTotalBlobLength(String contentRange) { -// return Long.parseLong(contentRange.split("/")[1]); -// } -// -// private static final class DownloadHelper { -// final long newCount; -// -// final BlobAccessConditions realConditions; -// -// final DownloadAsyncResponse initialResponse; -// -// DownloadHelper(long newCount, BlobAccessConditions realConditions, DownloadAsyncResponse initialResponse) { -// this.newCount = newCount; -// this.realConditions = realConditions; -// this.initialResponse = initialResponse; -// } -// } -// -// /** -// * Uploads the contents of an arbitrary {@code Flux} to a block blob. This Flowable need not be replayable and -// * therefore it may have as its source a network stream or any other data for which the replay behavior is unknown -// * (non-replayable meaning the Flowable may not return the exact same data on each subscription). -// * -// * To eliminate the need for replayability on the source, the client must perform some buffering in order to ensure -// * the actual data passed to the network is replayable. This is important in order to support retries, which are -// * crucial for reliable data transfer. Typically, the greater the number of buffers used, the greater the possible -// * parallelism. Larger buffers means we will have to stage fewer blocks. The tradeoffs between these values are -// * context-dependent, so some experimentation may be required to optimize inputs for a given scenario. -// * -// * Note that buffering must be strictly sequential. Only the upload portion of this operation may be parallelized; -// * the reads cannot be. Therefore, this method is not as optimal as -// * {@link #uploadFileToBlockBlob(AsynchronousFileChannel, BlockBlobURL, int, Integer, TransferManagerUploadToBlockBlobOptions)} -// * and if the source is known to be a file, that method should be preferred. -// * -// * @param source -// * Contains the data to upload. Unlike other upload methods in this library, this method does not require -// * that the Flowable be replayable. -// * @param blockBlobURL -// * Points to the blob to which the data should be uploaded. -// * @param blockSize -// * The size of each block that will be staged. This value also determines the size that each buffer used by -// * this method will be and determines the number of requests that need to be made. The amount of memory -// * consumed by this method may be up to blockSize * numBuffers. If block size is large, this method will -// * make fewer network calls, but each individual call will send more data and will therefore take longer. -// * @param numBuffers -// * The maximum number of buffers this method should allocate. Must be at least two. Generally this value -// * should have some relationship to the value for parallelism passed via the options. If the number of -// * available buffers is smaller than the level of parallelism, then this method will not be able to make -// * full use of the available parallelism. It is unlikely that the value need be more than two times the -// * level of parallelism as such a value means that (assuming buffering is fast enough) there are enough -// * available buffers to have both one occupied for each worker and one ready for all workers should they -// * all complete the current request at approximately the same time. The amount of memory consumed by this -// * method may be up to blockSize * numBuffers. -// * @param options -// * {@link TransferManagerUploadToBlockBlobOptions} -// * @return Emits the successful response. -// * -// * @apiNote ## Sample Code \n -// * [!code-java[Sample_Code](../azure-storage-java/src/test/java/com/microsoft/azure/storage/Samples.java?name=tm_nrf "Sample code for TransferManager.uploadFromNonReplayableFlowable")] \n -// * For more samples, please see the [Samples file](%https://github.com/Azure/azure-storage-java/blob/master/src/test/java/com/microsoft/azure/storage/Samples.java) -// */ -// public static Single uploadFromNonReplayableFlowable( -// final Flowable source, final BlockBlobURL blockBlobURL, final int blockSize, -// final int numBuffers, final TransferManagerUploadToBlockBlobOptions options) { -// Utility.assertNotNull("source", source); -// Utility.assertNotNull("blockBlobURL", blockBlobURL); -// -// TransferManagerUploadToBlockBlobOptions optionsReal = options == null -// ? new TransferManagerUploadToBlockBlobOptions() : options; -// -// // See ProgressReporter for an explanation on why this lock is necessary and why we use AtomicLong. -// AtomicLong totalProgress = new AtomicLong(0); -// Lock progressLock = new ReentrantLock(); -// -// // Validation done in the constructor. -// UploadFromNRFBufferPool pool = new UploadFromNRFBufferPool(numBuffers, blockSize); -// -// /* -// Break the source flowable into chunks that are <= chunk size. This makes filling the pooled buffers much easier -// as we can guarantee we only need at most two buffers for any call to write (two in the case of one pool buffer -// filling up with more data to write) -// */ -// Flowable chunkedSource = source.flatMap(buffer -> { -// if (buffer.remaining() <= blockSize) { -// return Flowable.just(buffer); -// } -// List smallerChunks = new ArrayList<>(); -// for (int i = 0; i < Math.ceil(buffer.remaining() / (double) blockSize); i++) { -// // Note that duplicate does not duplicate data. It simply creates a duplicate view of the data. -// ByteBuffer duplicate = buffer.duplicate(); -// duplicate.position(i * blockSize); -// duplicate.limit(Math.min(duplicate.limit(), (i + 1) * blockSize)); -// smallerChunks.add(duplicate); -// } -// return Flowable.fromIterable(smallerChunks); -// }, false, 1); -// -// /* -// Write each buffer from the chunkedSource to the pool and call flush at the end to get the last bits. -// */ -// return chunkedSource.flatMap(pool::write, false, 1) -// .concatWith(Flowable.defer(pool::flush)) -// .concatMapEager(buffer -> { -// // Report progress as necessary. -// Flowable data = ProgressReporter.addParallelProgressReporting(Flowable.just(buffer), -// optionsReal.progressReceiver(), progressLock, totalProgress); -// -// final String blockId = Base64.getEncoder().encodeToString( -// UUID.randomUUID().toString().getBytes(UTF_8)); -// -// /* -// Make a call to stageBlock. Instead of emitting the response, which we don't care about other -// than that it was successful, emit the blockId for this request. These will be collected below. -// Turn that into an Observable which emits one item to comply with the signature of -// concatMapEager. -// */ -// return blockBlobURL.stageBlock(blockId, data, -// buffer.remaining(), optionsReal.accessConditions().leaseAccessConditions(), null) -// .map(x -> { -// pool.returnBuffer(buffer); -// return blockId; -// }).toFlowable(); -// -// /* -// Specify the number of concurrent subscribers to this map. This determines how many concurrent -// rest calls are made. This is so because maxConcurrency is the number of internal subscribers -// available to subscribe to the Observables emitted by the source. A subscriber is not released -// for a new subscription until its Observable calls onComplete, which here means that the call to -// stageBlock is finished. Prefetch is a hint that each of the Observables emitted by the source -// will emit only one value, which is true here because we have converted from a Single. -// */ -// }, optionsReal.parallelism(), 1) -// /* -// collectInto will gather each of the emitted blockIds into a list. Because we used concatMap, the Ids -// will be emitted according to their block number, which means the list generated here will be -// properly ordered. This also converts into a Single. -// */ -// .collectInto(new ArrayList(), ArrayList::add) -// /* -// collectInto will not emit the list until its source calls onComplete. This means that by the time we -// call stageBlock list, all of the stageBlock calls will have finished. By flatMapping the list, we -// can "map" it into a call to commitBlockList. -// */ -// .flatMap(ids -> -// blockBlobURL.commitBlockList(ids, optionsReal.httpHeaders(), optionsReal.metadata(), -// optionsReal.accessConditions(), null)); -// -// } -//} diff --git a/storage/client/src/main/java/com/azure/storage/blob/TransferManagerDownloadFromBlobOptions.java b/storage/client/src/main/java/com/azure/storage/blob/TransferManagerDownloadFromBlobOptions.java deleted file mode 100644 index a4c621a4c3cbd..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/TransferManagerDownloadFromBlobOptions.java +++ /dev/null @@ -1,105 +0,0 @@ -//// Copyright (c) Microsoft Corporation. All rights reserved. -//// Licensed under the MIT License. -// -//package com.azure.storage.blob; -// -///** -// * Configures the parallel download behavior for methods on the {@link TransferManager}. -// */ -//public final class TransferManagerDownloadFromBlobOptions { -// -// private final long chunkSize; -// -// private final IProgressReceiver progressReceiver; -// -// private final int parallelism; -// -// private final ReliableDownloadOptions reliableDownloadOptionsPerBlock; -// -// // Cannot be final because we may have to set this property in order to lock on the etag. -// private BlobAccessConditions accessConditions; -// -// public TransferManagerDownloadFromBlobOptions() { -// this(null, null, null, null, null); -// } -// -// /** -// * Returns an object that configures the parallel download behavior for methods on the {@link TransferManager}. -// * -// * @param chunkSize -// * The size of the chunk into which large download operations will be broken into. Note that if the -// * chunkSize is large, fewer but larger requests will be made as each REST request will download a -// * single chunk in full. For larger chunk sizes, it may be helpful to configure the -// * {@code reliableDownloadOptions} to allow more retries. -// * @param progressReceiver -// * {@link IProgressReceiver} -// * @param accessConditions -// * {@link BlobAccessConditions} -// * @param reliableDownloadOptions -// * {@link ReliableDownloadOptions} -// * @param parallelism -// * A {@code int} that indicates the maximum number of chunks to download in parallel. Must be greater -// * than 0. May be null to accept default behavior. -// */ -// public TransferManagerDownloadFromBlobOptions(Long chunkSize, IProgressReceiver progressReceiver, -// BlobAccessConditions accessConditions, ReliableDownloadOptions reliableDownloadOptions, -// Integer parallelism) { -// this.progressReceiver = progressReceiver; -// -// if (chunkSize != null) { -// Utility.assertInBounds("chunkSize", chunkSize, 1, Long.MAX_VALUE); -// this.chunkSize = chunkSize; -// } else { -// this.chunkSize = TransferManager.BLOB_DEFAULT_DOWNLOAD_BLOCK_SIZE; -// } -// -// if (parallelism != null) { -// Utility.assertInBounds("parallelism", parallelism, 1, Integer.MAX_VALUE); -// this.parallelism = parallelism; -// } else { -// this.parallelism = Constants.TRANSFER_MANAGER_DEFAULT_PARALLELISM; -// } -// -// this.accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; -// this.reliableDownloadOptionsPerBlock = reliableDownloadOptions == null -// ? new ReliableDownloadOptions() : reliableDownloadOptions; -// } -// -// /** -// * The size of the chunk into which large download operations will be broken into. Note that if the chunkSize is -// * large, fewer but larger requests will be made as each REST request will download a single chunk in full. For -// * larger chunk sizes, it may be helpful to configure the{@code reliableDownloadOptions} to allow more retries. -// */ -// public long chunkSize() { -// return chunkSize; -// } -// -// /** -// * {@link IProgressReceiver} -// */ -// public IProgressReceiver progressReceiver() { -// return progressReceiver; -// } -// -// /** -// * A {@code int} that indicates the maximum number of chunks to download in parallel. Must be greater than 0. May be -// * null to accept default behavior. -// */ -// public int parallelism() { -// return parallelism; -// } -// -// /** -// * {@link ReliableDownloadOptions} -// */ -// public ReliableDownloadOptions reliableDownloadOptionsPerBlock() { -// return reliableDownloadOptionsPerBlock; -// } -// -// /** -// * {@link BlobAccessConditions} -// */ -// public BlobAccessConditions accessConditions() { -// return accessConditions; -// } -//} diff --git a/storage/client/src/main/java/com/azure/storage/blob/TransferManagerUploadToBlockBlobOptions.java b/storage/client/src/main/java/com/azure/storage/blob/TransferManagerUploadToBlockBlobOptions.java deleted file mode 100644 index 279f2eba3f239..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/TransferManagerUploadToBlockBlobOptions.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.storage.blob.models.BlobHTTPHeaders; - -/** - * Configures the parallel upload behavior for methods on the {@link TransferManager}. - */ -class TransferManagerUploadToBlockBlobOptions { - - private final IProgressReceiver progressReceiver; - - private final BlobHTTPHeaders httpHeaders; - - private final Metadata metadata; - - private final BlobAccessConditions accessConditions; - - private final int parallelism; - - public TransferManagerUploadToBlockBlobOptions() { - this(null, null, null, null, null); - } - - /** - * Creates a new object that configures the parallel upload behavior. Null may be passed to accept the default - * behavior. - * - * @param progressReceiver - * {@link IProgressReceiver} - * @param httpHeaders - * Most often used when creating a blob or setting its properties, this class contains fields for typical - * HTTP properties, which, if specified, will be attached to the target blob. Null may be passed to any API. - * @param metadata - * {@link Metadata} - * @param accessConditions - * {@link BlobAccessConditions} - * @param parallelism - * Indicates the maximum number of blocks to upload in parallel. Must be greater than 0. - * May be null to accept default behavior. - */ - public TransferManagerUploadToBlockBlobOptions(IProgressReceiver progressReceiver, BlobHTTPHeaders httpHeaders, - Metadata metadata, BlobAccessConditions accessConditions, Integer parallelism) { - this.progressReceiver = progressReceiver; - if (parallelism != null) { - Utility.assertInBounds("parallelism", parallelism, 0, Integer.MAX_VALUE); - this.parallelism = parallelism; - } else { - this.parallelism = Constants.TRANSFER_MANAGER_DEFAULT_PARALLELISM; - } - - this.httpHeaders = httpHeaders; - this.metadata = metadata; - this.accessConditions = accessConditions == null ? new BlobAccessConditions() : accessConditions; - } - - /** - * {@link IProgressReceiver} - */ - public IProgressReceiver progressReceiver() { - return progressReceiver; - } - - /** - * Most often used when creating a blob or setting its properties, this class contains fields for typical HTTP - * properties, which, if specified, will be attached to the target blob. Null may be passed to any API. - */ - public BlobHTTPHeaders httpHeaders() { - return httpHeaders; - } - - /** - * {@link Metadata} - */ - public Metadata metadata() { - return metadata; - } - - /** - * {@link BlobAccessConditions} - */ - public BlobAccessConditions accessConditions() { - return accessConditions; - } - - /** - * A {@code int} that indicates the maximum number of blocks to upload in parallel. Must be greater than 0. May be - * null to accept default behavior. - */ - public int parallelism() { - return parallelism; - } - -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/URLParser.java b/storage/client/src/main/java/com/azure/storage/blob/URLParser.java deleted file mode 100644 index 46808f88142c3..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/URLParser.java +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import java.net.URL; -import java.net.UnknownHostException; -import java.util.Comparator; -import java.util.Locale; -import java.util.Map; -import java.util.TreeMap; - -/** - * A class used to conveniently parse URLs into {@link BlobURLParts} to modify the components of the URL. - */ -final class URLParser { - - /** - * URLParser parses a URL initializing BlobURLParts' fields including any SAS-related and snapshot query parameters. - * Any other query parameters remain in the UnparsedParams field. This method overwrites all fields in the - * BlobURLParts object. - * - * @param url - * The {@code URL} to be parsed. - * - * @return A {@link BlobURLParts} object containing all the components of a BlobURL. - * - * @throws UnknownHostException - * If the url contains an improperly formatted ipaddress or unknown host address. - */ - public static BlobURLParts parse(URL url) throws UnknownHostException { - - final String scheme = url.getProtocol(); - final String host = url.getHost(); - - String containerName = null; - String blobName = null; - - // find the container & blob names (if any) - String path = url.getPath(); - if (!Utility.isNullOrEmpty(path)) { - // if the path starts with a slash remove it - if (path.charAt(0) == '/') { - path = path.substring(1); - } - - int containerEndIndex = path.indexOf('/'); - if (containerEndIndex == -1) { - // path contains only a container name and no blob name - containerName = path; - } else { - // path contains the container name up until the slash and blob name is everything after the slash - containerName = path.substring(0, containerEndIndex); - blobName = path.substring(containerEndIndex + 1); - } - } - Map queryParamsMap = parseQueryString(url.getQuery()); - - String snapshot = null; - String[] snapshotArray = queryParamsMap.get("snapshot"); - if (snapshotArray != null) { - snapshot = snapshotArray[0]; - queryParamsMap.remove("snapshot"); - } - - SASQueryParameters sasQueryParameters = new SASQueryParameters(queryParamsMap, true); - - return new BlobURLParts() - .withScheme(scheme) - .withHost(host) - .withContainerName(containerName) - .withBlobName(blobName) - .withSnapshot(snapshot) - .withSasQueryParameters(sasQueryParameters) - .withUnparsedParameters(queryParamsMap); - } - - /** - * Parses a query string into a one to many hashmap. - * - * @param queryParams - * The string of query params to parse. - * - * @return A {@code HashMap} of the key values. - */ - private static TreeMap parseQueryString(String queryParams) { - - final TreeMap retVals = new TreeMap(new Comparator() { - @Override - public int compare(String s1, String s2) { - return s1.compareTo(s2); - } - }); - - if (Utility.isNullOrEmpty(queryParams)) { - return retVals; - } - - // split name value pairs by splitting on the 'c&' character - final String[] valuePairs = queryParams.split("&"); - - // for each field value pair parse into appropriate map entries - for (int m = 0; m < valuePairs.length; m++) { - // Getting key and value for a single query parameter - final int equalDex = valuePairs[m].indexOf("="); - String key = Utility.safeURLDecode(valuePairs[m].substring(0, equalDex)).toLowerCase(Locale.ROOT); - String value = Utility.safeURLDecode(valuePairs[m].substring(equalDex + 1)); - - // add to map - String[] keyValues = retVals.get(key); - - // check if map already contains key - if (keyValues == null) { - // map does not contain this key - keyValues = new String[]{value}; - } else { - // map contains this key already so append - final String[] newValues = new String[keyValues.length + 1]; - for (int j = 0; j < keyValues.length; j++) { - newValues[j] = keyValues[j]; - } - - newValues[newValues.length - 1] = value; - keyValues = newValues; - } - retVals.put(key, keyValues); - } - - return retVals; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/UploadFromNRFBufferPool.java b/storage/client/src/main/java/com/azure/storage/blob/UploadFromNRFBufferPool.java deleted file mode 100644 index e238a54e2bd2f..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/UploadFromNRFBufferPool.java +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import reactor.core.publisher.Flux; - -import java.nio.ByteBuffer; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.LinkedBlockingQueue; - -/** - * This type is to support the implementation of uploadFromNonReplaybleFlowable only. It is mandatory that the caller - * has broken the source into ByteBuffers that are no greater than the size of a chunk and therefore a buffer in the - * pool. This is necessary because it upper bounds the number of buffers we need for a given call to write() to 2. If - * the size of ByteBuffer passed into write() were unbounded, the pool could stall as it would run out of buffers before - * it is able to return a result, and if it is unable to return, no data can be uploaded and therefore no pools - * returned. - * - * It is incumbent upon the caller to return the buffers after an upload is completed. It is also the caller's - * responsibility to signal to the pool when the stream is empty and call flush to return any data still sitting in - * the pool. - * - * Broadly, the workflow of this operation is to chunk the source into reasonable sized pieces. On each piece, one - * thread will call write on the pool. The pool will grab a buffer from the queue to write to, possibly waiting for one - * to be available, and either store the incomplete buffer to be filled on the next write or return the buffer to be - * sent. Filled buffers can be uploaded in parallel and should return buffers to the pool after the upload completes. - * Once the source terminates, it should call flush. - */ -final class UploadFromNRFBufferPool { - - private final BlockingQueue buffers; - - private final int maxBuffs; - - private int numBuffs = 0; - - private final int buffSize; - - private ByteBuffer currentBuf; - - UploadFromNRFBufferPool(final int numBuffs, final int buffSize) { - /* - We require at least two buffers because it is possible that a given write will spill over into a second buffer. - We only need one overflow buffer because the max size of a ByteBuffer is assumed to be the size as a buffer in - the pool. - */ - Utility.assertInBounds("numBuffs", numBuffs, 2, Integer.MAX_VALUE); - this.maxBuffs = numBuffs; - buffers = new LinkedBlockingQueue<>(numBuffs); - - - //These buffers will be used in calls to stageBlock, so they must be no greater than block size. - Utility.assertInBounds("buffSize", buffSize, 1, BlockBlobAsyncClient.MAX_STAGE_BLOCK_BYTES); - this.buffSize = buffSize; - - //We prep the queue with two buffers in case there is overflow. - buffers.add(ByteBuffer.allocate(this.buffSize)); - buffers.add(ByteBuffer.allocate(this.buffSize)); - this.numBuffs = 2; - } - - public Flux write(ByteBuffer buf) { - // Check if there's a buffer holding any data from a previous call to write. If not, get a new one. - if (this.currentBuf == null) { - this.currentBuf = this.getBuffer(); - } - - Flux result; - // We can fit this whole write in the buffer we currently have. - if (this.currentBuf.remaining() >= buf.remaining()) { - this.currentBuf.put(buf); - if (this.currentBuf.remaining() == 0) { - // Reset the position so that we can read the whole thing then return this buffer. - this.currentBuf.position(0); - result = Flux.just(this.currentBuf); - // This will force us to get a new buffer next time we try to write. - this.currentBuf = null; - } else { - /* - We are still filling the current buffer, so we have no data to return. We will return the buffer once it - is filled - */ - result = Flux.empty(); - } - } else { - // We will overflow the current buffer and require another one. - // Adjust the window of buf so that we fill up currentBuf without going out of bounds. - int oldLimit = buf.limit(); - buf.limit(buf.position() + this.currentBuf.remaining()); - this.currentBuf.put(buf); - // Set the old limit so we can read to the end in the next buffer. - buf.limit(oldLimit); - - // Reset the position so we can read the buffer. - this.currentBuf.position(0); - result = Flux.just(this.currentBuf); - - /* - Get a new buffer and fill it with whatever is left from buf. Note that this relies on the assumption that - the source Flowable has been split up into buffers that are no bigger than chunk size. This assumption - means we'll only have to over flow once, and the buffer we overflow into will not be filled. This is the - buffer we will write to on the next call to write(). - */ - this.currentBuf = this.getBuffer(); - this.currentBuf.put(buf); - } - return result; - } - - private ByteBuffer getBuffer() { - ByteBuffer result; - // There are no buffers in the queue and we have space to allocate one. - if (this.buffers.isEmpty() && this.numBuffs < this.maxBuffs) { - result = ByteBuffer.allocate(this.buffSize); - this.numBuffs++; - } else { - try { - // If empty, this will wait for an upload to finish and return a buffer. - result = this.buffers.take(); - - } catch (InterruptedException e) { - throw new IllegalStateException("UploadFromStream thread interrupted." + " Thread:" - + Thread.currentThread().getId()); - } - } - return result; - } - - Flux flush() { - /* - Prep and return any data left in the pool. It is important to set the limit so that we don't read beyond the - actual data as this buffer may have been used before and therefore may have some garbage at the end. - */ - if (this.currentBuf != null) { - this.currentBuf.flip(); - ByteBuffer last = this.currentBuf; - // If there is an accidental duplicate call to flush, this prevents sending the last buffer twice - this.currentBuf = null; - return Flux.just(last); - } - return Flux.empty(); - } - - void returnBuffer(ByteBuffer b) { - // Reset the buffer. - b.position(0); - b.limit(b.capacity()); - - try { - this.buffers.put(b); - } catch (InterruptedException e) { - throw new IllegalStateException("UploadFromStream thread interrupted."); - } - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/Utility.java b/storage/client/src/main/java/com/azure/storage/blob/Utility.java deleted file mode 100644 index b512862576c6a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/Utility.java +++ /dev/null @@ -1,336 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.blob; - -import com.azure.core.implementation.http.UrlBuilder; -import com.azure.storage.blob.models.StorageErrorException; -import com.azure.storage.blob.models.UserDelegationKey; -import reactor.core.publisher.Mono; - -import javax.crypto.Mac; -import javax.crypto.spec.SecretKeySpec; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLDecoder; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.time.LocalDateTime; -import java.time.OffsetDateTime; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; -import java.util.Base64; -import java.util.Locale; - -final class Utility { - - static final DateTimeFormatter RFC_1123_GMT_DATE_FORMATTER = - DateTimeFormatter.ofPattern("EEE, dd MMM yyyy HH:mm:ss z", Locale.ROOT).withZone(ZoneId.of("GMT")); - - static final DateTimeFormatter ISO_8601_UTC_DATE_FORMATTER = - DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ROOT).withZone(ZoneId.of("UTC")); - /** - * Stores a reference to the UTC time zone. - */ - static final ZoneId UTC_ZONE = ZoneId.of("UTC"); - /** - * Stores a reference to the date/time pattern with the greatest precision Java.util.Date is capable of expressing. - */ - private static final String MAX_PRECISION_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSS"; - /** - * Stores a reference to the ISO8601 date/time pattern. - */ - private static final String ISO8601_PATTERN = "yyyy-MM-dd'T'HH:mm:ss'Z'"; - /** - * Stores a reference to the ISO8601 date/time pattern. - */ - private static final String ISO8601_PATTERN_NO_SECONDS = "yyyy-MM-dd'T'HH:mm'Z'"; - /** - * The length of a datestring that matches the MAX_PRECISION_PATTERN. - */ - private static final int MAX_PRECISION_DATESTRING_LENGTH = MAX_PRECISION_PATTERN.replaceAll("'", "").length(); - - /** - * Asserts that a value is not null. - * - * @param param - * A {@code String} that represents the name of the parameter, which becomes the exception message - * text if the value parameter is null. - * @param value - * An Object object that represents the value of the specified parameter. This is the value - * being asserted as not null. - */ - static void assertNotNull(final String param, final Object value) { - if (value == null) { - throw new IllegalArgumentException(String.format(Locale.ROOT, SR.ARGUMENT_NULL_OR_EMPTY, param)); - } - } - - /** - * Returns a value that indicates whether the specified string is null or empty. - * - * @param value - * A {@code String} being examined for null or empty. - * - * @return true if the specified value is null or empty; otherwise, false - */ - static boolean isNullOrEmpty(final String value) { - return value == null || value.length() == 0; - } - - /** - * Performs safe decoding of the specified string, taking care to preserve each + character, rather - * than replacing it with a space character. - * - * @param stringToDecode - * A {@code String} that represents the string to decode. - * - * @return A {@code String} that represents the decoded string. - */ - static String safeURLDecode(final String stringToDecode) { - if (stringToDecode.length() == 0) { - return Constants.EMPTY_STRING; - } - - // '+' are decoded as ' ' so preserve before decoding - if (stringToDecode.contains("+")) { - final StringBuilder outBuilder = new StringBuilder(); - - int startDex = 0; - for (int m = 0; m < stringToDecode.length(); m++) { - if (stringToDecode.charAt(m) == '+') { - if (m > startDex) { - try { - outBuilder.append(URLDecoder.decode(stringToDecode.substring(startDex, m), - Constants.UTF8_CHARSET)); - } catch (UnsupportedEncodingException e) { - throw new Error(e); - } - } - - outBuilder.append("+"); - startDex = m + 1; - } - } - - if (startDex != stringToDecode.length()) { - try { - outBuilder.append(URLDecoder.decode(stringToDecode.substring(startDex, stringToDecode.length()), - Constants.UTF8_CHARSET)); - } catch (UnsupportedEncodingException e) { - throw new Error(e); - } - } - - return outBuilder.toString(); - } else { - try { - return URLDecoder.decode(stringToDecode, Constants.UTF8_CHARSET); - } catch (UnsupportedEncodingException e) { - throw new Error(e); - } - } - } - - /** - * Given a String representing a date in a form of the ISO8601 pattern, generates a Date representing it - * with up to millisecond precision. - * - * @param dateString - * the {@code String} to be interpreted as a Date - * - * @return the corresponding Date object - */ - public static OffsetDateTime parseDate(String dateString) { - String pattern = MAX_PRECISION_PATTERN; - switch (dateString.length()) { - case 28: // "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"-> [2012-01-04T23:21:59.1234567Z] length = 28 - case 27: // "yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'"-> [2012-01-04T23:21:59.123456Z] length = 27 - case 26: // "yyyy-MM-dd'T'HH:mm:ss.SSSSS'Z'"-> [2012-01-04T23:21:59.12345Z] length = 26 - case 25: // "yyyy-MM-dd'T'HH:mm:ss.SSSS'Z'"-> [2012-01-04T23:21:59.1234Z] length = 25 - case 24: // "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"-> [2012-01-04T23:21:59.123Z] length = 24 - dateString = dateString.substring(0, MAX_PRECISION_DATESTRING_LENGTH); - break; - case 23: // "yyyy-MM-dd'T'HH:mm:ss.SS'Z'"-> [2012-01-04T23:21:59.12Z] length = 23 - // SS is assumed to be milliseconds, so a trailing 0 is necessary - dateString = dateString.replace("Z", "0"); - break; - case 22: // "yyyy-MM-dd'T'HH:mm:ss.S'Z'"-> [2012-01-04T23:21:59.1Z] length = 22 - // S is assumed to be milliseconds, so trailing 0's are necessary - dateString = dateString.replace("Z", "00"); - break; - case 20: // "yyyy-MM-dd'T'HH:mm:ss'Z'"-> [2012-01-04T23:21:59Z] length = 20 - pattern = Utility.ISO8601_PATTERN; - break; - case 17: // "yyyy-MM-dd'T'HH:mm'Z'"-> [2012-01-04T23:21Z] length = 17 - pattern = Utility.ISO8601_PATTERN_NO_SECONDS; - break; - default: - throw new IllegalArgumentException(String.format(Locale.ROOT, SR.INVALID_DATE_STRING, dateString)); - } - - DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern, Locale.ROOT); - return LocalDateTime.parse(dateString, formatter).atZone(UTC_ZONE).toOffsetDateTime(); - } - - /** - * Asserts that the specified integer is in the valid range. - * - * @param param - * A String that represents the name of the parameter, which becomes the exception message - * text if the value parameter is out of bounds. - * @param value - * The value of the specified parameter. - * @param min - * The minimum value for the specified parameter. - * @param max - * The maximum value for the specified parameter. - */ - public static void assertInBounds(final String param, final long value, final long min, final long max) { - if (value < min || value > max) { - throw new IllegalArgumentException(String.format(Locale.ROOT, SR.PARAMETER_NOT_IN_RANGE, param, min, max)); - } - } - - /** - * Performs safe encoding of the specified string, taking care to insert %20 for each space character, - * instead of inserting the + character. - */ - static String safeURLEncode(final String stringToEncode) { - if (stringToEncode == null) { - return null; - } - if (stringToEncode.length() == 0) { - return Constants.EMPTY_STRING; - } - - try { - final String tString = URLEncoder.encode(stringToEncode, Constants.UTF8_CHARSET); - - if (stringToEncode.contains(" ")) { - final StringBuilder outBuilder = new StringBuilder(); - - int startDex = 0; - for (int m = 0; m < stringToEncode.length(); m++) { - if (stringToEncode.charAt(m) == ' ') { - if (m > startDex) { - outBuilder.append(URLEncoder.encode(stringToEncode.substring(startDex, m), - Constants.UTF8_CHARSET)); - } - - outBuilder.append("%20"); - startDex = m + 1; - } - } - - if (startDex != stringToEncode.length()) { - outBuilder.append(URLEncoder.encode(stringToEncode.substring(startDex, stringToEncode.length()), - Constants.UTF8_CHARSET)); - } - - return outBuilder.toString(); - } else { - return tString; - } - - } catch (final UnsupportedEncodingException e) { - throw new Error(e); // If we can't encode UTF-8, we fail. - } - } - - static Mono postProcessResponse(Mono s) { - s = addErrorWrappingToSingle(s); - s = scrubEtagHeaderInResponse(s); - return s; - } - - /* - We need to convert the generated StorageErrorException to StorageException, which has a cleaner interface and - methods to conveniently access important values. - */ - private static Mono addErrorWrappingToSingle(Mono s) { - return s.onErrorResume( - StorageErrorException.class, - e -> e.response().bodyAsString().flatMap(body -> Mono.error(new StorageException(e, body)))); - } - - /* - The service is inconsistent in whether or not the etag header value has quotes. This method will check if the - response returns an etag value, and if it does, remove any quotes that may be present to give the user a more - predictable format to work with. - */ - private static Mono scrubEtagHeaderInResponse(Mono s) { - return s.map(response -> { - try { - Object headers = response.getClass().getMethod("headers").invoke(response); - Method etagGetterMethod = headers.getClass().getMethod("eTag"); - String etag = (String) etagGetterMethod.invoke(headers); - // CommitBlockListHeaders has an etag property, but it's only set if the blob has committed blocks. - if (etag == null) { - return response; - } - etag = etag.replace("\"", ""); // Etag headers without the quotes will be unaffected. - headers.getClass().getMethod("withETag", String.class).invoke(headers, etag); - } catch (NoSuchMethodException e) { - // Response did not return an eTag value. No change necessary. - } catch (IllegalAccessException | InvocationTargetException e) { - //TODO validate this won't throw - } - return response; - }); - } - - /** - * Computes a signature for the specified string using the HMAC-SHA256 algorithm. - * - * @param delegate - * Key used to sign - * @param stringToSign - * The UTF-8-encoded string to sign. - * - * @return A {@code String} that contains the HMAC-SHA256-encoded signature. - * - * @throws InvalidKeyException - * If the accountKey is not a valid Base64-encoded string. - */ - static String delegateComputeHmac256(final UserDelegationKey delegate, String stringToSign) throws InvalidKeyException { - try { - byte[] key = Base64.getDecoder().decode(delegate.value()); - Mac hmacSha256 = Mac.getInstance("HmacSHA256"); - hmacSha256.init(new SecretKeySpec(key, "HmacSHA256")); - byte[] utf8Bytes = stringToSign.getBytes(StandardCharsets.UTF_8); - return Base64.getEncoder().encodeToString(hmacSha256.doFinal(utf8Bytes)); - } catch (final NoSuchAlgorithmException e) { - throw new Error(e); - } - } - - /** - * Appends a string to the end of a URL's path (prefixing the string with a '/' if required). - * - * @param baseURL - * The url to which the name should be appended. - * @param name - * The name to be appended. - * - * @return A url with the name appended. - * - * @throws MalformedURLException - * Appending the specified name produced an invalid URL. - */ - static URL appendToURLPath(URL baseURL, String name) throws MalformedURLException { - UrlBuilder url = UrlBuilder.parse(baseURL.toString()); - if (url.path() == null) { - url.path("/"); // .path() will return null if it is empty, so we have to process separately from below. - } else if (url.path().charAt(url.path().length() - 1) != '/') { - url.path(url.path() + '/'); - } - url.path(url.path() + name); - return new URL(url.toString()); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java b/storage/client/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java deleted file mode 100644 index eea979ef28e44..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/implementation/AppendBlobsImpl.java +++ /dev/null @@ -1,378 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -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.util.Base64Util; -import com.azure.core.util.Context; -import com.azure.storage.blob.models.AppendBlobsAppendBlockFromUrlResponse; -import com.azure.storage.blob.models.AppendBlobsAppendBlockResponse; -import com.azure.storage.blob.models.AppendBlobsCreateResponse; -import com.azure.storage.blob.models.AppendPositionAccessConditions; -import com.azure.storage.blob.models.BlobHTTPHeaders; -import com.azure.storage.blob.models.EncryptionAlgorithmType; -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.ModifiedAccessConditions; -import com.azure.storage.blob.models.SourceModifiedAccessConditions; -import com.azure.storage.blob.models.StorageErrorException; -import io.netty.buffer.ByteBuf; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.net.URL; -import java.time.OffsetDateTime; -import java.util.Map; - -/** - * An instance of this class provides access to all the operations defined in - * AppendBlobs. - */ -public final class AppendBlobsImpl { - /** - * The proxy service used to perform REST calls. - */ - private AppendBlobsService service; - - /** - * The service client containing this operation class. - */ - private AzureBlobStorageImpl client; - - /** - * Initializes an instance of 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.client = client; - } - - /** - * The interface defining all the services for AppendBlobs to be used by - * the proxy service to perform REST calls. - */ - @Host("{url}") - @Service("Storage Blobs AppendBlob") - private interface AppendBlobsService { - @PUT("{containerName}/{blob}") - @ExpectedResponses({201}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono create(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); - - @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}") - @ExpectedResponses({201, 304}) - @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); - } - - /** - * The Create Append Blob operation creates a new append blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param contentLength The length of the request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, Context context) { - final Integer timeout = null; - final Map metadata = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; - final String requestId = null; - final String blobType = "AppendBlob"; - final String blobContentType = null; - final String blobContentEncoding = null; - final String blobContentLanguage = null; - final String blobCacheControl = null; - final String blobContentDisposition = null; - final String leaseId = null; - final String ifMatch = null; - final String ifNoneMatch = null; - String blobContentMD5Converted = null; - DateTimeRfc1123 ifModifiedSinceConverted = null; - DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.create(containerName, blob, this.client.url(), timeout, contentLength, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, blobType, blobContentType, blobContentEncoding, blobContentLanguage, blobContentMD5Converted, blobCacheControl, blobContentDisposition, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); - } - - /** - * The Create Append Blob operation creates a new append blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param contentLength The length of the request. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param blobHTTPHeaders Additional parameters for the operation. - * @param leaseAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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; - if (blobHTTPHeaders != null) { - blobContentType = blobHTTPHeaders.blobContentType(); - } - String blobContentEncoding = null; - if (blobHTTPHeaders != null) { - blobContentEncoding = blobHTTPHeaders.blobContentEncoding(); - } - String blobContentLanguage = null; - if (blobHTTPHeaders != null) { - blobContentLanguage = blobHTTPHeaders.blobContentLanguage(); - } - byte[] blobContentMD5 = null; - if (blobHTTPHeaders != null) { - blobContentMD5 = blobHTTPHeaders.blobContentMD5(); - } - String blobCacheControl = null; - if (blobHTTPHeaders != null) { - blobCacheControl = blobHTTPHeaders.blobCacheControl(); - } - String blobContentDisposition = null; - if (blobHTTPHeaders != null) { - blobContentDisposition = blobHTTPHeaders.blobContentDisposition(); - } - String leaseId = null; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. - * - * @param containerName The container name. - * @param blob The blob name. - * @param body Initial data. - * @param contentLength The length of the request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - public Mono appendBlockWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Context context) { - final Integer timeout = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; - final String requestId = null; - final String comp = "appendblock"; - final String leaseId = null; - final Long maxSize = null; - final Long appendPosition = null; - final String ifMatch = null; - final String ifNoneMatch = null; - 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); - } - - /** - * The Append Block operation commits a new block of data to the end of an existing append blob. The Append Block operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. - * - * @param containerName The container name. - * @param blob The blob name. - * @param body Initial data. - * @param contentLength The length of the request. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param appendPositionAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - Long maxSize = null; - if (appendPositionAccessConditions != null) { - maxSize = appendPositionAccessConditions.maxSize(); - } - Long appendPosition = null; - if (appendPositionAccessConditions != null) { - appendPosition = appendPositionAccessConditions.appendPosition(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * The Append Block operation commits a new block of data to the end of an existing append blob where the contents are read from a source url. The Append Block operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. - * - * @param containerName The container name. - * @param blob The blob name. - * @param sourceUrl Specify a URL to the copy source. - * @param contentLength The length of the request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - public Mono appendBlockFromUrlWithRestResponseAsync(String containerName, String blob, URL sourceUrl, long contentLength, Context context) { - final String sourceRange = null; - final Integer timeout = null; - final String requestId = null; - final String comp = "appendblock"; - final String leaseId = null; - final Long maxSize = null; - final Long appendPosition = null; - final String ifMatch = null; - final String ifNoneMatch = null; - final String sourceIfMatch = null; - final String sourceIfNoneMatch = null; - String sourceContentMD5Converted = null; - DateTimeRfc1123 ifModifiedSinceConverted = null; - 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); - } - - /** - * The Append Block operation commits a new block of data to the end of an existing append blob where the contents are read from a source url. The Append Block operation is permitted only if the blob was created with x-ms-blob-type set to AppendBlob. Append Block is supported only on version 2015-02-21 version or later. - * - * @param containerName The container name. - * @param blob The blob name. - * @param sourceUrl Specify a URL to the copy source. - * @param contentLength The length of the request. - * @param sourceRange Bytes of source data in the specified range. - * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param appendPositionAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @param sourceModifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - Long maxSize = null; - if (appendPositionAccessConditions != null) { - maxSize = appendPositionAccessConditions.maxSize(); - } - Long appendPosition = null; - if (appendPositionAccessConditions != null) { - appendPosition = appendPositionAccessConditions.appendPosition(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - OffsetDateTime sourceIfModifiedSince = null; - if (sourceModifiedAccessConditions != null) { - sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince(); - } - OffsetDateTime sourceIfUnmodifiedSince = null; - if (sourceModifiedAccessConditions != null) { - sourceIfUnmodifiedSince = sourceModifiedAccessConditions.sourceIfUnmodifiedSince(); - } - String sourceIfMatch = null; - if (sourceModifiedAccessConditions != null) { - sourceIfMatch = sourceModifiedAccessConditions.sourceIfMatch(); - } - String sourceIfNoneMatch = null; - if (sourceModifiedAccessConditions != null) { - sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); - } - String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); - DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); - DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); - DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.appendBlockFromUrl(containerName, blob, this.client.url(), sourceUrl, sourceRange, sourceContentMD5Converted, timeout, contentLength, this.client.version(), requestId, comp, leaseId, maxSize, appendPosition, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, sourceIfModifiedSinceConverted, sourceIfUnmodifiedSinceConverted, sourceIfMatch, sourceIfNoneMatch, context); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java b/storage/client/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java deleted file mode 100644 index c77d984c4e928..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageBuilder.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.implementation.RestProxy; - -/** - * A builder for creating a new instance of the AzureBlobStorage type. - */ -public final class AzureBlobStorageBuilder { - /* - * The URL of the service account, container, or blob that is the targe of the desired operation. - */ - private String url; - - /** - * Sets The URL of the service account, container, or blob that is the targe of the desired operation. - * - * @param url the url value. - * @return the AzureBlobStorageBuilder. - */ - public AzureBlobStorageBuilder url(String url) { - this.url = url; - return this; - } - - /* - * Specifies the version of the operation to use for this request. - */ - private String version; - - /** - * Sets Specifies the version of the operation to use for this request. - * - * @param version the version value. - * @return the AzureBlobStorageBuilder. - */ - public AzureBlobStorageBuilder version(String version) { - this.version = version; - return this; - } - - /* - * The HTTP pipeline to send requests through - */ - private HttpPipeline pipeline; - - /** - * Sets The HTTP pipeline to send requests through. - * - * @param pipeline the pipeline value. - * @return the AzureBlobStorageBuilder. - */ - public AzureBlobStorageBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; - return this; - } - - /** - * Builds an instance of AzureBlobStorageImpl with the provided parameters. - * - * @return an instance of AzureBlobStorageImpl. - */ - public AzureBlobStorageImpl build() { - if (version == null) { - this.version = "2018-11-09"; - } - if (pipeline == null) { - this.pipeline = RestProxy.createDefaultPipeline(); - } - AzureBlobStorageImpl client = new AzureBlobStorageImpl(pipeline); - if (this.url != null) { - client.url(this.url); - } - if (this.version != null) { - client.version(this.version); - } - return client; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java b/storage/client/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java deleted file mode 100644 index 9ade2a9d9c10b..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/implementation/AzureBlobStorageImpl.java +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.implementation; - -import com.azure.core.http.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 { - /** - * The URL of the service account, container, or blob that is the targe of the desired operation. - */ - private String url; - - /** - * Gets The URL of the service account, container, or blob that is the targe of the desired operation. - * - * @return the url value. - */ - public String url() { - return this.url; - } - - /** - * Sets The URL of the service account, container, or blob that is the targe of the desired operation. - * - * @param url the url value. - * @return the service client itself. - */ - AzureBlobStorageImpl url(String url) { - this.url = url; - return this; - } - - /** - * Specifies the version of the operation to use for this request. - */ - private String version; - - /** - * Gets Specifies the version of the operation to use for this request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Sets Specifies the version of the operation to use for this request. - * - * @param version the version value. - * @return the service client itself. - */ - AzureBlobStorageImpl version(String version) { - this.version = version; - return this; - } - - /** - * The ServicesImpl object to access its operations. - */ - private ServicesImpl services; - - /** - * Gets the ServicesImpl object to access its operations. - * - * @return the ServicesImpl object. - */ - public ServicesImpl services() { - return this.services; - } - - /** - * The ContainersImpl object to access its operations. - */ - private ContainersImpl containers; - - /** - * Gets the ContainersImpl object to access its operations. - * - * @return the ContainersImpl object. - */ - public ContainersImpl containers() { - return this.containers; - } - - /** - * The BlobsImpl object to access its operations. - */ - private BlobsImpl blobs; - - /** - * Gets the BlobsImpl object to access its operations. - * - * @return the BlobsImpl object. - */ - public BlobsImpl blobs() { - return this.blobs; - } - - /** - * The PageBlobsImpl object to access its operations. - */ - private PageBlobsImpl pageBlobs; - - /** - * Gets the PageBlobsImpl object to access its operations. - * - * @return the PageBlobsImpl object. - */ - public PageBlobsImpl pageBlobs() { - return this.pageBlobs; - } - - /** - * The AppendBlobsImpl object to access its operations. - */ - private AppendBlobsImpl appendBlobs; - - /** - * Gets the AppendBlobsImpl object to access its operations. - * - * @return the AppendBlobsImpl object. - */ - public AppendBlobsImpl appendBlobs() { - return this.appendBlobs; - } - - /** - * The BlockBlobsImpl object to access its operations. - */ - private BlockBlobsImpl blockBlobs; - - /** - * Gets the BlockBlobsImpl object to access its operations. - * - * @return the BlockBlobsImpl object. - */ - public BlockBlobsImpl blockBlobs() { - return this.blockBlobs; - } - - /** - * Initializes an instance of AzureBlobStorage client. - */ - public AzureBlobStorageImpl() { - this(RestProxy.createDefaultPipeline()); - } - - /** - * Initializes an instance of AzureBlobStorage client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - */ - public AzureBlobStorageImpl(HttpPipeline httpPipeline) { - super(httpPipeline); - this.services = new ServicesImpl(this); - this.containers = new ContainersImpl(this); - this.blobs = new BlobsImpl(this); - this.pageBlobs = new PageBlobsImpl(this); - this.appendBlobs = new AppendBlobsImpl(this); - this.blockBlobs = new BlockBlobsImpl(this); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java b/storage/client/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java deleted file mode 100644 index 8dac0f9bdbfa5..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/implementation/BlobsImpl.java +++ /dev/null @@ -1,1211 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -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.util.Base64Util; -import com.azure.core.util.Context; -import com.azure.storage.blob.models.AccessTier; -import com.azure.storage.blob.models.BlobHTTPHeaders; -import com.azure.storage.blob.models.BlobsAbortCopyFromURLResponse; -import com.azure.storage.blob.models.BlobsAcquireLeaseResponse; -import com.azure.storage.blob.models.BlobsBreakLeaseResponse; -import com.azure.storage.blob.models.BlobsChangeLeaseResponse; -import com.azure.storage.blob.models.BlobsCopyFromURLResponse; -import com.azure.storage.blob.models.BlobsCreateSnapshotResponse; -import com.azure.storage.blob.models.BlobsDeleteResponse; -import com.azure.storage.blob.models.BlobsDownloadResponse; -import com.azure.storage.blob.models.BlobsGetAccountInfoResponse; -import com.azure.storage.blob.models.BlobsGetPropertiesResponse; -import com.azure.storage.blob.models.BlobsReleaseLeaseResponse; -import com.azure.storage.blob.models.BlobsRenewLeaseResponse; -import com.azure.storage.blob.models.BlobsSetHTTPHeadersResponse; -import com.azure.storage.blob.models.BlobsSetMetadataResponse; -import com.azure.storage.blob.models.BlobsSetTierResponse; -import com.azure.storage.blob.models.BlobsStartCopyFromURLResponse; -import com.azure.storage.blob.models.BlobsUndeleteResponse; -import com.azure.storage.blob.models.DeleteSnapshotsOptionType; -import com.azure.storage.blob.models.EncryptionAlgorithmType; -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.ModifiedAccessConditions; -import com.azure.storage.blob.models.SourceModifiedAccessConditions; -import com.azure.storage.blob.models.StorageErrorException; -import reactor.core.publisher.Mono; - -import java.net.URL; -import java.time.OffsetDateTime; -import java.util.Map; - -/** - * An instance of this class provides access to all the operations defined in - * Blobs. - */ -public final class BlobsImpl { - /** - * The proxy service used to perform REST calls. - */ - private BlobsService service; - - /** - * The service client containing this operation class. - */ - private AzureBlobStorageImpl client; - - /** - * Initializes an instance of 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.client = client; - } - - /** - * The interface defining all the services for Blobs to be used by the - * proxy service to perform REST calls. - */ - @Host("{url}") - @Service("Storage Blobs") - private interface BlobsService { - @GET("{containerName}/{blob}") - @ExpectedResponses({200, 206, 304}) - @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}") - @ExpectedResponses({200, 304}) - @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}") - @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}") - @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}") - @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}") - @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}") - @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}") - @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}") - @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}") - @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}") - @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}") - @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}") - @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}") - @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}") - @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}") - @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}") - @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); - } - - /** - * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or verison. - * - * @param containerName The container name. - * @param blob The blob name. - * @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. - */ - public Mono downloadWithRestResponseAsync(String containerName, String blob, Context context) { - final String snapshot = null; - final String versionId = null; - final Integer timeout = null; - final String range = null; - final Boolean rangeGetContentMD5 = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; - final String requestId = null; - final String leaseId = null; - final String ifMatch = null; - final String ifNoneMatch = null; - DateTimeRfc1123 ifModifiedSinceConverted = null; - DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.download(containerName, blob, this.client.url(), snapshot, versionId, timeout, range, rangeGetContentMD5, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); - } - - /** - * The Download operation reads or downloads a blob from the system, including its metadata and properties. You can also call Download to read a snapshot or verison. - * - * @param containerName The container name. - * @param blob The blob name. - * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param range Return only the bytes of the blob in the specified range. - * @param rangeGetContentMD5 When set to true and specified together with the Range, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @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. - */ - 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) { - leaseId = leaseAccessConditions.leaseId(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @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. - */ - public Mono getPropertiesWithRestResponseAsync(String containerName, String blob, Context context) { - final String snapshot = null; - final String versionId = null; - final Integer timeout = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; - final String requestId = null; - final String leaseId = null; - final String ifMatch = null; - final String ifNoneMatch = null; - DateTimeRfc1123 ifModifiedSinceConverted = null; - DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.getProperties(containerName, blob, this.client.url(), snapshot, versionId, timeout, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, leaseId, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, context); - } - - /** - * The Get Properties operation returns all user-defined metadata, standard HTTP properties, and system properties for the blob. It does not return the content of the blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @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. - */ - 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) { - leaseId = leaseAccessConditions.leaseId(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * 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. - * - * @param containerName The container name. - * @param blob The blob name. - * @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. - */ - public Mono deleteWithRestResponseAsync(String containerName, String blob, Context context) { - final String snapshot = null; - final String versionId = null; - final Integer timeout = null; - final DeleteSnapshotsOptionType deleteSnapshots = null; - final String requestId = null; - final String leaseId = null; - final String ifMatch = null; - final String ifNoneMatch = null; - DateTimeRfc1123 ifModifiedSinceConverted = null; - DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.delete(containerName, blob, this.client.url(), snapshot, versionId, timeout, deleteSnapshots, this.client.version(), 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. - * - * @param containerName The container name. - * @param blob The blob name. - * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param deleteSnapshots Required if the blob has associated snapshots. Specify one of the following two options: include: Delete the base blob and all of its snapshots. only: Delete only the blob's snapshots and not the blob itself. Possible values include: 'include', 'only'. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @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. - */ - 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) { - leaseId = leaseAccessConditions.leaseId(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * Undelete a blob that was previously soft deleted. - * - * @param containerName The container name. - * @param blob The blob name. - * @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. - */ - 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); - } - - /** - * Undelete a blob that was previously soft deleted. - * - * @param containerName The container name. - * @param blob The blob name. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param 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. - */ - 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); - } - - /** - * The Set HTTP Headers operation sets system properties on the blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @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. - */ - public Mono setHTTPHeadersWithRestResponseAsync(String containerName, String blob, Context context) { - final Integer timeout = null; - final String requestId = null; - final String comp = "properties"; - final String blobCacheControl = null; - final String blobContentType = null; - final String blobContentEncoding = null; - final String blobContentLanguage = null; - final String blobContentDisposition = null; - final String leaseId = null; - final String ifMatch = null; - final String ifNoneMatch = null; - 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); - } - - /** - * The Set HTTP Headers operation sets system properties on the blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param blobHTTPHeaders Additional parameters for the operation. - * @param leaseAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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; - if (blobHTTPHeaders != null) { - blobCacheControl = blobHTTPHeaders.blobCacheControl(); - } - String blobContentType = null; - if (blobHTTPHeaders != null) { - blobContentType = blobHTTPHeaders.blobContentType(); - } - byte[] blobContentMD5 = null; - if (blobHTTPHeaders != null) { - blobContentMD5 = blobHTTPHeaders.blobContentMD5(); - } - String blobContentEncoding = null; - if (blobHTTPHeaders != null) { - blobContentEncoding = blobHTTPHeaders.blobContentEncoding(); - } - String blobContentLanguage = null; - if (blobHTTPHeaders != null) { - blobContentLanguage = blobHTTPHeaders.blobContentLanguage(); - } - String blobContentDisposition = null; - if (blobHTTPHeaders != null) { - blobContentDisposition = blobHTTPHeaders.blobContentDisposition(); - } - String leaseId = null; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value pairs. - * - * @param containerName The container name. - * @param blob The blob name. - * @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. - */ - public Mono setMetadataWithRestResponseAsync(String containerName, String blob, Context context) { - final Integer timeout = null; - final Map metadata = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; - final String requestId = null; - final String comp = "metadata"; - final String leaseId = null; - final String ifMatch = null; - 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); - } - - /** - * The Set Blob Metadata operation sets user-defined metadata for the specified blob as one or more name-value pairs. - * - * @param containerName The container name. - * @param blob The blob name. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @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. - */ - 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; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * - * @param containerName The container name. - * @param blob The blob name. - * @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. - */ - public Mono acquireLeaseWithRestResponseAsync(String containerName, String blob, Context context) { - final Integer timeout = null; - final Integer duration = null; - final String proposedLeaseId = null; - final String requestId = null; - final String comp = "lease"; - final String action = "acquire"; - final String ifMatch = null; - 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); - } - - /** - * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * - * @param containerName The container name. - * @param blob The blob name. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or change. - * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID string formats. - * @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 modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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"; - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * - * @param containerName The container name. - * @param blob The blob name. - * @param leaseId Specifies the current lease ID on the resource. - * @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. - */ - public Mono releaseLeaseWithRestResponseAsync(String containerName, String blob, String leaseId, Context context) { - final Integer timeout = null; - final String requestId = null; - final String comp = "lease"; - final String action = "release"; - final String ifMatch = null; - 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); - } - - /** - * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * - * @param containerName The container name. - * @param blob The blob name. - * @param leaseId Specifies the current lease ID on the resource. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param 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 modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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"; - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * - * @param containerName The container name. - * @param blob The blob name. - * @param leaseId Specifies the current lease ID on the resource. - * @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. - */ - public Mono renewLeaseWithRestResponseAsync(String containerName, String blob, String leaseId, Context context) { - final Integer timeout = null; - final String requestId = null; - final String comp = "lease"; - final String action = "renew"; - final String ifMatch = null; - 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); - } - - /** - * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * - * @param containerName The container name. - * @param blob The blob name. - * @param leaseId Specifies the current lease ID on the resource. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param 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 modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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"; - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * - * @param containerName The container name. - * @param blob The blob name. - * @param leaseId Specifies the current lease ID on the resource. - * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID string formats. - * @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. - */ - public Mono changeLeaseWithRestResponseAsync(String containerName, String blob, String leaseId, String proposedLeaseId, Context context) { - final Integer timeout = null; - final String requestId = null; - final String comp = "lease"; - final String action = "change"; - final String ifMatch = null; - 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); - } - - /** - * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * - * @param containerName The container name. - * @param blob The blob name. - * @param leaseId Specifies the current lease ID on the resource. - * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID string formats. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param 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 modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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"; - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * - * @param containerName The container name. - * @param blob The blob name. - * @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. - */ - public Mono breakLeaseWithRestResponseAsync(String containerName, String blob, Context context) { - final Integer timeout = null; - final Integer breakPeriod = null; - final String requestId = null; - final String comp = "lease"; - final String action = "break"; - final String ifMatch = null; - 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); - } - - /** - * [Update] The Lease Blob operation establishes and manages a lock on a blob for write and delete operations. - * - * @param containerName The container name. - * @param blob The blob name. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param breakPeriod For a break operation, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks immediately. - * @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 modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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"; - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * The Create Snapshot operation creates a read-only snapshot of a blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @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. - */ - public Mono createSnapshotWithRestResponseAsync(String containerName, String blob, Context context) { - final Integer timeout = null; - final Map metadata = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; - final String requestId = null; - final String comp = "snapshot"; - final String ifMatch = null; - final String ifNoneMatch = null; - final String leaseId = null; - DateTimeRfc1123 ifModifiedSinceConverted = null; - DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.createSnapshot(containerName, blob, this.client.url(), timeout, metadata, encryptionKey, encryptionKeySha256, encryptionAlgorithm, this.client.version(), requestId, comp, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, ifMatch, ifNoneMatch, leaseId, context); - } - - /** - * The Create Snapshot operation creates a read-only snapshot of a blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. - * @param 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 modifiedAccessConditions Additional parameters for the operation. - * @param leaseAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - String leaseId = null; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - 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); - } - - /** - * The Start Copy From URL operation copies a blob or an internet resource to a new blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated via a shared access signature. - * @param 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. - */ - public Mono startCopyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) { - final Integer timeout = null; - final Map metadata = null; - final String requestId = null; - final String sourceIfMatch = null; - final String sourceIfNoneMatch = null; - final String ifMatch = null; - final String ifNoneMatch = null; - final String leaseId = null; - DateTimeRfc1123 sourceIfModifiedSinceConverted = null; - 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); - } - - /** - * The Start Copy From URL operation copies a blob or an internet resource to a new blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated via a shared access signature. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param sourceModifiedAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @param leaseAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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) { - sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince(); - } - OffsetDateTime sourceIfUnmodifiedSince = null; - if (sourceModifiedAccessConditions != null) { - sourceIfUnmodifiedSince = sourceModifiedAccessConditions.sourceIfUnmodifiedSince(); - } - String sourceIfMatch = null; - if (sourceModifiedAccessConditions != null) { - sourceIfMatch = sourceModifiedAccessConditions.sourceIfMatch(); - } - String sourceIfNoneMatch = null; - if (sourceModifiedAccessConditions != null) { - sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - String leaseId = null; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); - 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); - } - - /** - * The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response until the copy is complete. - * - * @param containerName The container name. - * @param blob The blob name. - * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated via a shared access signature. - * @param 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. - */ - public Mono copyFromURLWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) { - final Integer timeout = null; - final Map metadata = null; - final String requestId = null; - final String xMsRequiresSync = "true"; - final String sourceIfMatch = null; - final String sourceIfNoneMatch = null; - final String ifMatch = null; - final String ifNoneMatch = null; - final String leaseId = null; - DateTimeRfc1123 sourceIfModifiedSinceConverted = null; - 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); - } - - /** - * The Copy From URL operation copies a blob or an internet resource to a new blob. It will not return a response until the copy is complete. - * - * @param containerName The container name. - * @param blob The blob name. - * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated via a shared access signature. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param sourceModifiedAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @param leaseAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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; - if (sourceModifiedAccessConditions != null) { - sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince(); - } - OffsetDateTime sourceIfUnmodifiedSince = null; - if (sourceModifiedAccessConditions != null) { - sourceIfUnmodifiedSince = sourceModifiedAccessConditions.sourceIfUnmodifiedSince(); - } - String sourceIfMatch = null; - if (sourceModifiedAccessConditions != null) { - sourceIfMatch = sourceModifiedAccessConditions.sourceIfMatch(); - } - String sourceIfNoneMatch = null; - if (sourceModifiedAccessConditions != null) { - sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - String leaseId = null; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); - 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); - } - - /** - * The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with zero length and full metadata. - * - * @param containerName The container name. - * @param blob The blob name. - * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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); - } - - /** - * The Abort Copy From URL operation aborts a pending Copy From URL operation, and leaves a destination blob with zero length and full metadata. - * - * @param containerName The container name. - * @param blob The blob name. - * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy Blob operation. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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"; - String leaseId = null; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - return service.abortCopyFromURL(containerName, blob, this.client.url(), copyId, timeout, this.client.version(), requestId, comp, copyActionAbortConstant, leaseId, context); - } - - /** - * The Set Tier operation sets the tier on a blob. The operation is allowed on a page blob in a premium storage account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. - * - * @param containerName The container name. - * @param blob The blob name. - * @param tier Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P20', 'P30', 'P40', 'P50', 'Hot', 'Cool', 'Archive'. - * @param 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. - */ - 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); - } - - /** - * The Set Tier operation sets the tier on a blob. The operation is allowed on a page blob in a premium storage account and on a block blob in a blob storage account (locally redundant storage only). A premium page blob's tier determines the allowed size, IOPS, and bandwidth of the blob. A block blob's tier determines Hot/Cool/Archive storage type. This operation does not update the blob's ETag. - * - * @param containerName The container name. - * @param blob The blob name. - * @param tier Indicates the tier to be set on the blob. Possible values include: 'P4', 'P6', 'P10', 'P20', 'P30', 'P40', 'P50', 'Hot', 'Cool', 'Archive'. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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); - } - - /** - * Returns the sku name and account kind. - * - * @param containerName The container name. - * @param blob The blob name. - * @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. - */ - 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); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java b/storage/client/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java deleted file mode 100644 index cd9bfbb060805..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/implementation/BlockBlobsImpl.java +++ /dev/null @@ -1,483 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -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.util.Base64Util; -import com.azure.core.util.Context; -import com.azure.storage.blob.models.BlobHTTPHeaders; -import com.azure.storage.blob.models.BlockBlobsCommitBlockListResponse; -import com.azure.storage.blob.models.BlockBlobsGetBlockListResponse; -import com.azure.storage.blob.models.BlockBlobsStageBlockFromURLResponse; -import com.azure.storage.blob.models.BlockBlobsStageBlockResponse; -import com.azure.storage.blob.models.BlockBlobsUploadResponse; -import com.azure.storage.blob.models.BlockListType; -import com.azure.storage.blob.models.BlockLookupList; -import com.azure.storage.blob.models.EncryptionAlgorithmType; -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.ModifiedAccessConditions; -import com.azure.storage.blob.models.SourceModifiedAccessConditions; -import com.azure.storage.blob.models.StorageErrorException; -import io.netty.buffer.ByteBuf; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.net.URL; -import java.time.OffsetDateTime; -import java.util.Map; - -/** - * An instance of this class provides access to all the operations defined in - * BlockBlobs. - */ -public final class BlockBlobsImpl { - /** - * The proxy service used to perform REST calls. - */ - private BlockBlobsService service; - - /** - * The service client containing this operation class. - */ - private AzureBlobStorageImpl client; - - /** - * Initializes an instance of 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.client = client; - } - - /** - * The interface defining all the services for BlockBlobs to be used by the - * proxy service to perform REST calls. - */ - @Host("{url}") - @Service("Storage Blobs BlockBlob") - private interface BlockBlobsService { - @PUT("{containerName}/{blob}") - @ExpectedResponses({201}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono upload(@PathParam("containerName") String containerName, @PathParam("blob") String blob, @HostParam("url") String url, @BodyParam("application/octet-stream") Flux body, @QueryParam("timeout") Integer timeout, @HeaderParam("Content-Length") long contentLength, @HeaderParam("x-ms-meta-") Map metadata, @QueryParam("x-ms-encryption-key") String encryptionKey, @QueryParam("x-ms-encryption-key-sha256") String encryptionKeySha256, @QueryParam("x-ms-encryption-algorithm") EncryptionAlgorithmType encryptionAlgorithm, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @HeaderParam("x-ms-blob-type") String blobType, @HeaderParam("x-ms-blob-content-type") String blobContentType, @HeaderParam("x-ms-blob-content-encoding") String blobContentEncoding, @HeaderParam("x-ms-blob-content-language") String blobContentLanguage, @HeaderParam("x-ms-blob-content-md5") String blobContentMD5, @HeaderParam("x-ms-blob-cache-control") String blobCacheControl, @HeaderParam("x-ms-blob-content-disposition") String blobContentDisposition, @HeaderParam("x-ms-lease-id") String leaseId, @HeaderParam("If-Modified-Since") DateTimeRfc1123 ifModifiedSince, @HeaderParam("If-Unmodified-Since") DateTimeRfc1123 ifUnmodifiedSince, @HeaderParam("If-Match") String ifMatch, @HeaderParam("If-None-Match") String ifNoneMatch, Context context); - - @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}") - @ExpectedResponses({201, 304}) - @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}") - @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}") - @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); - } - - /** - * The Upload Block Blob operation updates the content of an existing block blob. Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a block blob, use the Put Block List operation. - * - * @param containerName The container name. - * @param blob The blob name. - * @param body Initial data. - * @param contentLength The length of the request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - public Mono uploadWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Context context) { - final Integer timeout = null; - final Map metadata = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; - final String requestId = null; - final String blobType = "BlockBlob"; - final String blobContentType = null; - final String blobContentEncoding = null; - final String blobContentLanguage = null; - final String blobCacheControl = null; - final String blobContentDisposition = null; - final String leaseId = null; - final String ifMatch = null; - final String ifNoneMatch = null; - String blobContentMD5Converted = null; - DateTimeRfc1123 ifModifiedSinceConverted = null; - DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.upload(containerName, blob, this.client.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); - } - - /** - * The Upload Block Blob operation updates the content of an existing block blob. Updating an existing block blob overwrites any existing metadata on the blob. Partial updates are not supported with Put Blob; the content of the existing blob is overwritten with the content of the new blob. To perform a partial update of the content of a block blob, use the Put Block List operation. - * - * @param containerName The container name. - * @param blob The blob name. - * @param body Initial data. - * @param contentLength The length of the request. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param blobHTTPHeaders Additional parameters for the operation. - * @param leaseAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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; - if (blobHTTPHeaders != null) { - blobContentType = blobHTTPHeaders.blobContentType(); - } - String blobContentEncoding = null; - if (blobHTTPHeaders != null) { - blobContentEncoding = blobHTTPHeaders.blobContentEncoding(); - } - String blobContentLanguage = null; - if (blobHTTPHeaders != null) { - blobContentLanguage = blobHTTPHeaders.blobContentLanguage(); - } - byte[] blobContentMD5 = null; - if (blobHTTPHeaders != null) { - blobContentMD5 = blobHTTPHeaders.blobContentMD5(); - } - String blobCacheControl = null; - if (blobHTTPHeaders != null) { - blobCacheControl = blobHTTPHeaders.blobCacheControl(); - } - String blobContentDisposition = null; - if (blobHTTPHeaders != null) { - blobContentDisposition = blobHTTPHeaders.blobContentDisposition(); - } - String leaseId = null; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * The Stage Block operation creates a new block to be committed as part of a blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block. - * @param contentLength The length of the request. - * @param body Initial data. - * @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. - */ - public Mono stageBlockWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, Flux body, Context context) { - final Integer timeout = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; - final String requestId = null; - 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); - } - - /** - * The Stage Block operation creates a new block to be committed as part of a blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block. - * @param contentLength The length of the request. - * @param body Initial data. - * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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; - if (leaseAccessConditions != null) { - 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); - } - - /** - * The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from a URL. - * - * @param containerName The container name. - * @param blob The blob name. - * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block. - * @param contentLength The length of the request. - * @param sourceUrl Specify a URL to the copy source. - * @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. - */ - public Mono stageBlockFromURLWithRestResponseAsync(String containerName, String blob, String blockId, long contentLength, URL sourceUrl, Context context) { - final String sourceRange = null; - final Integer timeout = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; - final String requestId = null; - final String comp = "block"; - final String leaseId = null; - final String sourceIfMatch = null; - final String sourceIfNoneMatch = null; - 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); - } - - /** - * The Stage Block operation creates a new block to be committed as part of a blob where the contents are read from a URL. - * - * @param containerName The container name. - * @param blob The blob name. - * @param blockId A valid Base64 string value that identifies the block. Prior to encoding, the string must be less than or equal to 64 bytes in size. For a given blob, the length of the value specified for the blockid parameter must be the same size for each block. - * @param contentLength The length of the request. - * @param sourceUrl Specify a URL to the copy source. - * @param sourceRange Bytes of source data in the specified range. - * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param sourceModifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - OffsetDateTime sourceIfModifiedSince = null; - if (sourceModifiedAccessConditions != null) { - sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince(); - } - OffsetDateTime sourceIfUnmodifiedSince = null; - if (sourceModifiedAccessConditions != null) { - sourceIfUnmodifiedSince = sourceModifiedAccessConditions.sourceIfUnmodifiedSince(); - } - String sourceIfMatch = null; - if (sourceModifiedAccessConditions != null) { - sourceIfMatch = sourceModifiedAccessConditions.sourceIfMatch(); - } - String sourceIfNoneMatch = null; - if (sourceModifiedAccessConditions != null) { - sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); - } - 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); - } - - /** - * The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block operation. You can call Put Block List to update a blob by uploading only those blocks that have changed, then committing the new and existing blocks together. You can do this by specifying whether to commit a block from the committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the block, whichever list it may belong to. - * - * @param containerName The container name. - * @param blob The blob name. - * @param blocks the BlockLookupList value. - * @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. - */ - public Mono commitBlockListWithRestResponseAsync(String containerName, String blob, BlockLookupList blocks, Context context) { - final Integer timeout = null; - final Map metadata = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; - final String requestId = null; - final String comp = "blocklist"; - final String blobCacheControl = null; - final String blobContentType = null; - final String blobContentEncoding = null; - final String blobContentLanguage = null; - final String blobContentDisposition = null; - final String leaseId = null; - final String ifMatch = null; - final String ifNoneMatch = null; - 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); - } - - /** - * The Commit Block List operation writes a blob by specifying the list of block IDs that make up the blob. In order to be written as part of a blob, a block must have been successfully written to the server in a prior Put Block operation. You can call Put Block List to update a blob by uploading only those blocks that have changed, then committing the new and existing blocks together. You can do this by specifying whether to commit a block from the committed block list or from the uncommitted block list, or to commit the most recently uploaded version of the block, whichever list it may belong to. - * - * @param containerName The container name. - * @param blob The blob name. - * @param blocks the BlockLookupList value. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param blobHTTPHeaders Additional parameters for the operation. - * @param leaseAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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; - if (blobHTTPHeaders != null) { - blobCacheControl = blobHTTPHeaders.blobCacheControl(); - } - String blobContentType = null; - if (blobHTTPHeaders != null) { - blobContentType = blobHTTPHeaders.blobContentType(); - } - String blobContentEncoding = null; - if (blobHTTPHeaders != null) { - blobContentEncoding = blobHTTPHeaders.blobContentEncoding(); - } - String blobContentLanguage = null; - if (blobHTTPHeaders != null) { - blobContentLanguage = blobHTTPHeaders.blobContentLanguage(); - } - byte[] blobContentMD5 = null; - if (blobHTTPHeaders != null) { - blobContentMD5 = blobHTTPHeaders.blobContentMD5(); - } - String blobContentDisposition = null; - if (blobHTTPHeaders != null) { - blobContentDisposition = blobHTTPHeaders.blobContentDisposition(); - } - String leaseId = null; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param listType Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together. Possible values include: 'committed', 'uncommitted', 'all'. - * @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. - */ - public Mono getBlockListWithRestResponseAsync(String containerName, String blob, BlockListType listType, Context context) { - final String snapshot = null; - final String versionId = null; - final Integer timeout = null; - 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); - } - - /** - * The Get Block List operation retrieves the list of blocks that have been uploaded as part of a block blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param listType Specifies whether to return the list of committed blocks, the list of uncommitted blocks, or both lists together. Possible values include: 'committed', 'uncommitted', 'all'. - * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java b/storage/client/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java deleted file mode 100644 index 780b3a356a619..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/implementation/ContainersImpl.java +++ /dev/null @@ -1,759 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -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.serializer.jackson.JacksonAdapter; -import com.azure.core.util.Context; -import com.azure.storage.blob.models.ContainersAcquireLeaseResponse; -import com.azure.storage.blob.models.ContainersBreakLeaseResponse; -import com.azure.storage.blob.models.ContainersChangeLeaseResponse; -import com.azure.storage.blob.models.ContainersCreateResponse; -import com.azure.storage.blob.models.ContainersDeleteResponse; -import com.azure.storage.blob.models.ContainersGetAccessPolicyResponse; -import com.azure.storage.blob.models.ContainersGetAccountInfoResponse; -import com.azure.storage.blob.models.ContainersGetPropertiesResponse; -import com.azure.storage.blob.models.ContainersListBlobFlatSegmentResponse; -import com.azure.storage.blob.models.ContainersListBlobHierarchySegmentResponse; -import com.azure.storage.blob.models.ContainersReleaseLeaseResponse; -import com.azure.storage.blob.models.ContainersRenewLeaseResponse; -import com.azure.storage.blob.models.ContainersSetAccessPolicyResponse; -import com.azure.storage.blob.models.ContainersSetMetadataResponse; -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.ListBlobsIncludeItem; -import com.azure.storage.blob.models.ModifiedAccessConditions; -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; - -/** - * An instance of this class provides access to all the operations defined in - * Containers. - */ -public final class ContainersImpl { - /** - * The proxy service used to perform REST calls. - */ - private ContainersService service; - - /** - * The service client containing this operation class. - */ - private AzureBlobStorageImpl client; - - /** - * Initializes an instance of 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.client = client; - } - - /** - * The interface defining all the services for Containers to be used by the - * proxy service to perform REST calls. - */ - @Host("{url}") - @Service("Storage Blobs Containers") - private interface ContainersService { - @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}") - @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}") - @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}") - @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}") - @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}") - @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); - - @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}") - @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}") - @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}") - @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}") - @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}") - @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}") - @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}") - @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); - } - - /** - * creates a new container under the specified account. If the container with the same name already exists, the operation fails. - * - * @param containerName The container name. - * @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. - */ - 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); - } - - /** - * creates a new container under the specified account. If the container with the same name already exists, the operation fails. - * - * @param containerName The container name. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param access Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: 'container', 'blob'. - * @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. - */ - 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); - } - - /** - * returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs. - * - * @param containerName The container name. - * @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. - */ - 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); - } - - /** - * returns all user-defined metadata and system properties for the specified container. The data returned does not include the container's list of blobs. - * - * @param containerName The container name. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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); - } - - /** - * operation marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection. - * - * @param containerName The container name. - * @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. - */ - public Mono deleteWithRestResponseAsync(String containerName, Context context) { - final Integer timeout = null; - final String requestId = null; - final String restype = "container"; - 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); - } - - /** - * operation marks the specified container for deletion. The container and any blobs contained within it are later deleted during garbage collection. - * - * @param containerName The container name. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @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. - */ - public Mono deleteWithRestResponseAsync(String containerName, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, ModifiedAccessConditions modifiedAccessConditions, Context context) { - final String restype = "container"; - String leaseId = null; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - 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); - } - - /** - * operation sets one or more user-defined name-value pairs for the specified container. - * - * @param containerName The container name. - * @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. - */ - public Mono setMetadataWithRestResponseAsync(String containerName, Context context) { - final Integer timeout = null; - final Map metadata = null; - final String requestId = null; - final String restype = "container"; - 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); - } - - /** - * operation sets one or more user-defined name-value pairs for the specified container. - * - * @param containerName The container name. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @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. - */ - 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"; - String leaseId = null; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - 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); - } - - /** - * gets the permissions for the specified container. The permissions indicate whether container data may be accessed publicly. - * - * @param containerName The container name. - * @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. - */ - 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); - } - - /** - * gets the permissions for the specified container. The permissions indicate whether container data may be accessed publicly. - * - * @param containerName The container name. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - public Mono getAccessPolicyWithRestResponseAsync(String containerName, Integer timeout, String requestId, LeaseAccessConditions leaseAccessConditions, Context context) { - final String restype = "container"; - final String comp = "acl"; - String leaseId = null; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - return service.getAccessPolicy(containerName, this.client.url(), timeout, this.client.version(), requestId, restype, comp, leaseId, context); - } - - /** - * sets the permissions for the specified container. The permissions indicate whether blobs in a container may be accessed publicly. - * - * @param containerName The container name. - * @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. - */ - public Mono setAccessPolicyWithRestResponseAsync(String containerName, Context context) { - final Integer timeout = null; - final PublicAccessType access = null; - final String requestId = null; - final String restype = "container"; - final String comp = "acl"; - final String leaseId = null; - SignedIdentifiersWrapper containerAclConverted = new SignedIdentifiersWrapper(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); - } - - /** - * sets the permissions for the specified container. The permissions indicate whether blobs in a container may be accessed publicly. - * - * @param containerName The container name. - * @param containerAcl the acls for the container. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param access Specifies whether data in the container may be accessed publicly and the level of access. Possible values include: 'container', 'blob'. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @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. - */ - 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"; - String leaseId = null; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - SignedIdentifiersWrapper containerAclConverted = new SignedIdentifiersWrapper(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); - } - - /** - * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - * - * @param containerName The container name. - * @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. - */ - public Mono acquireLeaseWithRestResponseAsync(String containerName, Context context) { - final Integer timeout = null; - final Integer duration = null; - final String proposedLeaseId = null; - final String requestId = null; - final String comp = "lease"; - final String restype = "container"; - 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); - } - - /** - * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - * - * @param containerName The container name. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param duration Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease can be between 15 and 60 seconds. A lease duration cannot be changed using renew or change. - * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID string formats. - * @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 modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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"; - final String action = "acquire"; - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - 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); - } - - /** - * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - * - * @param containerName The container name. - * @param leaseId Specifies the current lease ID on the resource. - * @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. - */ - public Mono releaseLeaseWithRestResponseAsync(String containerName, String leaseId, Context context) { - final Integer timeout = null; - final String requestId = null; - final String comp = "lease"; - final String restype = "container"; - 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); - } - - /** - * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - * - * @param containerName The container name. - * @param leaseId Specifies the current lease ID on the resource. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param 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 modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - public Mono releaseLeaseWithRestResponseAsync(String containerName, String leaseId, Integer timeout, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { - final String comp = "lease"; - final String restype = "container"; - final String action = "release"; - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - 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); - } - - /** - * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - * - * @param containerName The container name. - * @param leaseId Specifies the current lease ID on the resource. - * @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. - */ - public Mono renewLeaseWithRestResponseAsync(String containerName, String leaseId, Context context) { - final Integer timeout = null; - final String requestId = null; - final String comp = "lease"; - final String restype = "container"; - 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); - } - - /** - * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - * - * @param containerName The container name. - * @param leaseId Specifies the current lease ID on the resource. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param 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 modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - public Mono renewLeaseWithRestResponseAsync(String containerName, String leaseId, Integer timeout, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { - final String comp = "lease"; - final String restype = "container"; - final String action = "renew"; - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - 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); - } - - /** - * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - * - * @param containerName The container name. - * @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. - */ - public Mono breakLeaseWithRestResponseAsync(String containerName, Context context) { - final Integer timeout = null; - final Integer breakPeriod = null; - final String requestId = null; - final String comp = "lease"; - final String restype = "container"; - 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); - } - - /** - * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - * - * @param containerName The container name. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param breakPeriod For a break operation, proposed duration the lease should continue before it is broken, in seconds, between 0 and 60. This break period is only used if it is shorter than the time remaining on the lease. If longer, the time remaining on the lease is used. A new lease will not be available before the break period has expired, but the lease may be held for longer than the break period. If this header does not appear with a break operation, a fixed-duration lease breaks after the remaining lease period elapses, and an infinite lease breaks immediately. - * @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 modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - public Mono breakLeaseWithRestResponseAsync(String containerName, Integer timeout, Integer breakPeriod, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { - final String comp = "lease"; - final String restype = "container"; - final String action = "break"; - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - 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); - } - - /** - * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - * - * @param containerName The container name. - * @param leaseId Specifies the current lease ID on the resource. - * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID string formats. - * @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. - */ - public Mono changeLeaseWithRestResponseAsync(String containerName, String leaseId, String proposedLeaseId, Context context) { - final Integer timeout = null; - final String requestId = null; - final String comp = "lease"; - final String restype = "container"; - 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); - } - - /** - * [Update] establishes and manages a lock on a container for delete operations. The lock duration can be 15 to 60 seconds, or can be infinite. - * - * @param containerName The container name. - * @param leaseId Specifies the current lease ID on the resource. - * @param proposedLeaseId Proposed lease ID, in a GUID string format. The Blob service returns 400 (Invalid request) if the proposed lease ID is not in the correct format. See Guid Constructor (String) for a list of valid GUID string formats. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param 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 modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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"; - final String action = "change"; - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - 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); - } - - /** - * [Update] The List Blobs operation returns a list of the blobs under the specified container. - * - * @param containerName The container name. - * @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. - */ - public Mono listBlobFlatSegmentWithRestResponseAsync(String containerName, Context context) { - final String prefix = null; - final String marker = null; - final Integer maxresults = null; - final Integer timeout = null; - final String requestId = null; - 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); - } - - /** - * [Update] The List Blobs operation returns a list of the blobs under the specified container. - * - * @param containerName The container name. - * @param prefix Filters the results to return only containers whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the client. - * @param maxresults Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify one or more datasets to include in the response. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param 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. - */ - 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); - } - - /** - * [Update] The List Blobs operation returns a list of the blobs under the specified container. - * - * @param containerName The container name. - * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a single character or a string. - * @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. - */ - public Mono listBlobHierarchySegmentWithRestResponseAsync(String containerName, String delimiter, Context context) { - final String prefix = null; - final String marker = null; - final Integer maxresults = null; - final Integer timeout = null; - final String requestId = null; - 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); - } - - /** - * [Update] The List Blobs operation returns a list of the blobs under the specified container. - * - * @param containerName The container name. - * @param delimiter When the request includes this parameter, the operation returns a BlobPrefix element in the response body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a single character or a string. - * @param prefix Filters the results to return only containers whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the client. - * @param maxresults Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify one or more datasets to include in the response. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param 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. - */ - 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); - } - - /** - * Returns the sku name and account kind. - * - * @param containerName The container name. - * @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. - */ - 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); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/implementation/ListBlobsIncludeItemWrapper.java b/storage/client/src/main/java/com/azure/storage/blob/implementation/ListBlobsIncludeItemWrapper.java deleted file mode 100644 index 5616bafdc3336..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/implementation/ListBlobsIncludeItemWrapper.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.implementation; - -import com.azure.storage.blob.models.ListBlobsIncludeItem; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.List; - -/** - * A wrapper around List<ListBlobsIncludeItem> which provides top-level metadata for serialization. - */ -@JacksonXmlRootElement(localName = "ListBlobsIncludeItem") -public final class ListBlobsIncludeItemWrapper { - @JacksonXmlProperty(localName = "ListBlobsIncludeItem") - private final List listBlobsIncludeItem; - - /** - * Creates an instance of ListBlobsIncludeItemWrapper. - * - * @param listBlobsIncludeItem the list. - */ - @JsonCreator - public ListBlobsIncludeItemWrapper(@JsonProperty("ListBlobsIncludeItem") List listBlobsIncludeItem) { - this.listBlobsIncludeItem = listBlobsIncludeItem; - } - - /** - * Get the List<ListBlobsIncludeItem> contained in this wrapper. - * - * @return the List<ListBlobsIncludeItem>. - */ - public List items() { - return listBlobsIncludeItem; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java b/storage/client/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java deleted file mode 100644 index 9b552a71186bb..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/implementation/PageBlobsImpl.java +++ /dev/null @@ -1,842 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -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.util.Base64Util; -import com.azure.core.util.Context; -import com.azure.storage.blob.models.BlobHTTPHeaders; -import com.azure.storage.blob.models.EncryptionAlgorithmType; -import com.azure.storage.blob.models.LeaseAccessConditions; -import com.azure.storage.blob.models.ModifiedAccessConditions; -import com.azure.storage.blob.models.PageBlobsClearPagesResponse; -import com.azure.storage.blob.models.PageBlobsCopyIncrementalResponse; -import com.azure.storage.blob.models.PageBlobsCreateResponse; -import com.azure.storage.blob.models.PageBlobsGetPageRangesDiffResponse; -import com.azure.storage.blob.models.PageBlobsGetPageRangesResponse; -import com.azure.storage.blob.models.PageBlobsResizeResponse; -import com.azure.storage.blob.models.PageBlobsUpdateSequenceNumberResponse; -import com.azure.storage.blob.models.PageBlobsUploadPagesFromURLResponse; -import com.azure.storage.blob.models.PageBlobsUploadPagesResponse; -import com.azure.storage.blob.models.SequenceNumberAccessConditions; -import com.azure.storage.blob.models.SequenceNumberActionType; -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; - -/** - * An instance of this class provides access to all the operations defined in - * PageBlobs. - */ -public final class PageBlobsImpl { - /** - * The proxy service used to perform REST calls. - */ - private PageBlobsService service; - - /** - * The service client containing this operation class. - */ - private AzureBlobStorageImpl client; - - /** - * Initializes an instance of 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.client = client; - } - - /** - * The interface defining all the services for PageBlobs to be used by the - * proxy service to perform REST calls. - */ - @Host("{url}") - @Service("Storage Blobs PageBlobs") - private interface PageBlobsService { - @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}") - @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}") - @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}") - @ExpectedResponses({201, 304}) - @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}") - @ExpectedResponses({200, 304}) - @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}") - @ExpectedResponses({200, 304}) - @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}") - @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}") - @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}") - @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); - } - - /** - * The Create operation creates a new page blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param contentLength The length of the request. - * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary. - * @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. - */ - public Mono createWithRestResponseAsync(String containerName, String blob, long contentLength, long blobContentLength, Context context) { - final Integer timeout = null; - final Map metadata = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; - final Long blobSequenceNumber = 0L; - final String requestId = null; - final String blobType = "PageBlob"; - final String blobContentType = null; - final String blobContentEncoding = null; - final String blobContentLanguage = null; - final String blobCacheControl = null; - final String blobContentDisposition = null; - final String leaseId = null; - final String ifMatch = null; - final String ifNoneMatch = null; - String blobContentMD5Converted = null; - DateTimeRfc1123 ifModifiedSinceConverted = null; - DateTimeRfc1123 ifUnmodifiedSinceConverted = null; - return service.create(containerName, blob, this.client.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); - } - - /** - * The Create operation creates a new page blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param contentLength The length of the request. - * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param metadata Optional. Specifies a user-defined name-value pair associated with the blob. If no name-value pairs are specified, the operation will copy the metadata from the source blob or file to the destination blob. If one or more name-value pairs are specified, the destination blob is created with the specified metadata, and metadata is not copied from the source blob or file. Note that beginning with version 2009-09-19, metadata names must adhere to the naming rules for C# identifiers. See Naming and Referencing Containers, Blobs, and Metadata for more information. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. - * @param blobSequenceNumber Set for page blobs only. The sequence number is a user-controlled value that you can use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param blobHTTPHeaders Additional parameters for the operation. - * @param leaseAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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; - if (blobHTTPHeaders != null) { - blobContentType = blobHTTPHeaders.blobContentType(); - } - String blobContentEncoding = null; - if (blobHTTPHeaders != null) { - blobContentEncoding = blobHTTPHeaders.blobContentEncoding(); - } - String blobContentLanguage = null; - if (blobHTTPHeaders != null) { - blobContentLanguage = blobHTTPHeaders.blobContentLanguage(); - } - byte[] blobContentMD5 = null; - if (blobHTTPHeaders != null) { - blobContentMD5 = blobHTTPHeaders.blobContentMD5(); - } - String blobCacheControl = null; - if (blobHTTPHeaders != null) { - blobCacheControl = blobHTTPHeaders.blobCacheControl(); - } - String blobContentDisposition = null; - if (blobHTTPHeaders != null) { - blobContentDisposition = blobHTTPHeaders.blobContentDisposition(); - } - String leaseId = null; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * The Upload Pages operation writes a range of pages to a page blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param body Initial data. - * @param contentLength The length of the request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - public Mono uploadPagesWithRestResponseAsync(String containerName, String blob, Flux body, long contentLength, Context context) { - final Integer timeout = null; - final String range = null; - final String encryptionKey = null; - final String encryptionKeySha256 = null; - final EncryptionAlgorithmType encryptionAlgorithm = null; - final String requestId = null; - final String comp = "page"; - final String pageWrite = "update"; - final String leaseId = null; - final Long ifSequenceNumberLessThanOrEqualTo = null; - final Long ifSequenceNumberLessThan = null; - final Long ifSequenceNumberEqualTo = null; - final String ifMatch = null; - final String ifNoneMatch = null; - 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); - } - - /** - * The Upload Pages operation writes a range of pages to a page blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param body Initial data. - * @param contentLength The length of the request. - * @param transactionalContentMD5 Specify the transactional md5 for the body, to be validated by the service. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param range Return only the bytes of the blob in the specified range. - * @param encryptionKey Optional. Specifies the encryption key to use to encrypt the data provided in the request. If not specified, encryption is performed with the root account encryption key. For more information, see Encryption at Rest for Azure Storage Services. - * @param encryptionKeySha256 The SHA-256 hash of the provided encryption key. Must be provided if the x-ms-encryption-key header is provided. - * @param encryptionAlgorithm The algorithm used to produce the encryption key hash. Currently, the only accepted value is "AES256". Must be provided if the x-ms-encryption-key header is provided. Possible values include: 'AES256'. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param sequenceNumberAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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"; - String leaseId = null; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - Long ifSequenceNumberLessThanOrEqualTo = null; - if (sequenceNumberAccessConditions != null) { - ifSequenceNumberLessThanOrEqualTo = sequenceNumberAccessConditions.ifSequenceNumberLessThanOrEqualTo(); - } - Long ifSequenceNumberLessThan = null; - if (sequenceNumberAccessConditions != null) { - ifSequenceNumberLessThan = sequenceNumberAccessConditions.ifSequenceNumberLessThan(); - } - Long ifSequenceNumberEqualTo = null; - if (sequenceNumberAccessConditions != null) { - ifSequenceNumberEqualTo = sequenceNumberAccessConditions.ifSequenceNumberEqualTo(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * The Clear Pages operation clears a set of pages from a page blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param contentLength The length of the request. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - public Mono clearPagesWithRestResponseAsync(String containerName, String blob, long contentLength, Context context) { - final Integer timeout = null; - final String range = null; - final String requestId = null; - final String comp = "page"; - final String pageWrite = "clear"; - final String leaseId = null; - final Long ifSequenceNumberLessThanOrEqualTo = null; - final Long ifSequenceNumberLessThan = null; - final Long ifSequenceNumberEqualTo = null; - final String ifMatch = null; - 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); - } - - /** - * The Clear Pages operation clears a set of pages from a page blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param contentLength The length of the request. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param range Return only the bytes of the blob in the specified range. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param sequenceNumberAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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"; - String leaseId = null; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - Long ifSequenceNumberLessThanOrEqualTo = null; - if (sequenceNumberAccessConditions != null) { - ifSequenceNumberLessThanOrEqualTo = sequenceNumberAccessConditions.ifSequenceNumberLessThanOrEqualTo(); - } - Long ifSequenceNumberLessThan = null; - if (sequenceNumberAccessConditions != null) { - ifSequenceNumberLessThan = sequenceNumberAccessConditions.ifSequenceNumberLessThan(); - } - Long ifSequenceNumberEqualTo = null; - if (sequenceNumberAccessConditions != null) { - ifSequenceNumberEqualTo = sequenceNumberAccessConditions.ifSequenceNumberEqualTo(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. - * - * @param containerName The container name. - * @param blob The blob name. - * @param sourceUrl Specify a URL to the copy source. - * @param sourceRange Bytes of source data in the specified range. The length of this range should match the ContentLength header and x-ms-range/Range destination range header. - * @param contentLength The length of the request. - * @param range The range of bytes to which the source range would be written. The range should be 512 aligned and range-end is required. - * @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. - */ - 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; - final String comp = "page"; - final String pageWrite = "update"; - final String leaseId = null; - final Long ifSequenceNumberLessThanOrEqualTo = null; - final Long ifSequenceNumberLessThan = null; - final Long ifSequenceNumberEqualTo = null; - final String ifMatch = null; - final String ifNoneMatch = null; - final String sourceIfMatch = null; - final String sourceIfNoneMatch = null; - String sourceContentMD5Converted = null; - DateTimeRfc1123 ifModifiedSinceConverted = null; - 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); - } - - /** - * The Upload Pages operation writes a range of pages to a page blob where the contents are read from a URL. - * - * @param containerName The container name. - * @param blob The blob name. - * @param sourceUrl Specify a URL to the copy source. - * @param sourceRange Bytes of source data in the specified range. The length of this range should match the ContentLength header and x-ms-range/Range destination range header. - * @param contentLength The length of the request. - * @param range The range of bytes to which the source range would be written. The range should be 512 aligned and range-end is required. - * @param sourceContentMD5 Specify the md5 calculated for the range of bytes that must be read from the copy source. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param sequenceNumberAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @param sourceModifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - 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"; - String leaseId = null; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - Long ifSequenceNumberLessThanOrEqualTo = null; - if (sequenceNumberAccessConditions != null) { - ifSequenceNumberLessThanOrEqualTo = sequenceNumberAccessConditions.ifSequenceNumberLessThanOrEqualTo(); - } - Long ifSequenceNumberLessThan = null; - if (sequenceNumberAccessConditions != null) { - ifSequenceNumberLessThan = sequenceNumberAccessConditions.ifSequenceNumberLessThan(); - } - Long ifSequenceNumberEqualTo = null; - if (sequenceNumberAccessConditions != null) { - ifSequenceNumberEqualTo = sequenceNumberAccessConditions.ifSequenceNumberEqualTo(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - OffsetDateTime sourceIfModifiedSince = null; - if (sourceModifiedAccessConditions != null) { - sourceIfModifiedSince = sourceModifiedAccessConditions.sourceIfModifiedSince(); - } - OffsetDateTime sourceIfUnmodifiedSince = null; - if (sourceModifiedAccessConditions != null) { - sourceIfUnmodifiedSince = sourceModifiedAccessConditions.sourceIfUnmodifiedSince(); - } - String sourceIfMatch = null; - if (sourceModifiedAccessConditions != null) { - sourceIfMatch = sourceModifiedAccessConditions.sourceIfMatch(); - } - String sourceIfNoneMatch = null; - if (sourceModifiedAccessConditions != null) { - sourceIfNoneMatch = sourceModifiedAccessConditions.sourceIfNoneMatch(); - } - String sourceContentMD5Converted = Base64Util.encodeToString(sourceContentMD5); - DateTimeRfc1123 ifModifiedSinceConverted = ifModifiedSince == null ? null : new DateTimeRfc1123(ifModifiedSince); - DateTimeRfc1123 ifUnmodifiedSinceConverted = ifUnmodifiedSince == null ? null : new DateTimeRfc1123(ifUnmodifiedSince); - DateTimeRfc1123 sourceIfModifiedSinceConverted = sourceIfModifiedSince == null ? null : new DateTimeRfc1123(sourceIfModifiedSince); - DateTimeRfc1123 sourceIfUnmodifiedSinceConverted = sourceIfUnmodifiedSince == null ? null : new DateTimeRfc1123(sourceIfUnmodifiedSince); - return service.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); - } - - /** - * The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a page blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @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. - */ - public Mono getPageRangesWithRestResponseAsync(String containerName, String blob, Context context) { - final String snapshot = null; - final String versionId = null; - final Integer timeout = null; - final String range = null; - final String requestId = null; - final String comp = "pagelist"; - final String leaseId = null; - final String ifMatch = null; - 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); - } - - /** - * The Get Page Ranges operation returns the list of valid page ranges for a page blob, version or snapshot of a page blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param range Return only the bytes of the blob in the specified range. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @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. - */ - 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; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * [Update] The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were changed between target blob and previous snapshot or version. - * - * @param containerName The container name. - * @param blob The blob name. - * @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. - */ - public Mono getPageRangesDiffWithRestResponseAsync(String containerName, String blob, Context context) { - final String snapshot = null; - final String versionId = null; - final Integer timeout = null; - final String prevsnapshot = null; - final String range = null; - final String requestId = null; - final String comp = "pagelist"; - final String leaseId = null; - final String ifMatch = null; - 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); - } - - /** - * [Update] The Get Page Ranges Diff operation returns the list of valid page ranges for a page blob that were changed between target blob and previous snapshot or version. - * - * @param containerName The container name. - * @param blob The blob name. - * @param snapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the blob snapshot to retrieve. For more information on working with blob snapshots, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/creating-a-snapshot-of-a-blob">Creating a Snapshot of a Blob.</a>. - * @param versionId The version ID parameter is an opaque DateTime value that, when present, specifies the blob version to retrieve. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param prevsnapshot Optional in version 2015-07-08 and newer. The prevsnapshot parameter is a DateTime value that specifies that the response will contain only pages that were changed between target blob and previous snapshot. Changed pages include both updated and cleared pages. The target blob may be a snapshot, as long as the snapshot specified by prevsnapshot is the older of the two. Note that incremental snapshots are currently supported only for blobs created on or after January 1, 2016. - * @param range Return only the bytes of the blob in the specified range. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @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. - */ - 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; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * Resize the Blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary. - * @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. - */ - public Mono resizeWithRestResponseAsync(String containerName, String blob, long blobContentLength, Context context) { - final Integer timeout = null; - final String requestId = null; - final String comp = "properties"; - final String leaseId = null; - final String ifMatch = null; - 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); - } - - /** - * Resize the Blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param blobContentLength This header specifies the maximum size for the page blob, up to 1 TB. The page blob size must be aligned to a 512-byte boundary. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @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. - */ - 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; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * Update the sequence number of the blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param sequenceNumberAction Required if the x-ms-blob-sequence-number header is set for the request. This property applies to page blobs only. This property indicates how the service should modify the blob's sequence number. Possible values include: 'max', 'update', 'increment'. - * @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. - */ - public Mono updateSequenceNumberWithRestResponseAsync(String containerName, String blob, SequenceNumberActionType sequenceNumberAction, Context context) { - final Integer timeout = null; - final Long blobSequenceNumber = 0L; - final String requestId = null; - final String comp = "properties"; - final String leaseId = null; - final String ifMatch = null; - 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); - } - - /** - * Update the sequence number of the blob. - * - * @param containerName The container name. - * @param blob The blob name. - * @param sequenceNumberAction Required if the x-ms-blob-sequence-number header is set for the request. This property applies to page blobs only. This property indicates how the service should modify the blob's sequence number. Possible values include: 'max', 'update', 'increment'. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param blobSequenceNumber Set for page blobs only. The sequence number is a user-controlled value that you can use to track requests. The value of the sequence number must be between 0 and 2^63 - 1. - * @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled. - * @param leaseAccessConditions Additional parameters for the operation. - * @param modifiedAccessConditions Additional parameters for the operation. - * @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. - */ - 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; - if (leaseAccessConditions != null) { - leaseId = leaseAccessConditions.leaseId(); - } - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } - - /** - * The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual. This API is supported since REST version 2016-05-31. - * - * @param containerName The container name. - * @param blob The blob name. - * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated via a shared access signature. - * @param 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. - */ - public Mono copyIncrementalWithRestResponseAsync(String containerName, String blob, URL copySource, Context context) { - final Integer timeout = null; - final String requestId = null; - final String comp = "incrementalcopy"; - final String ifMatch = null; - 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); - } - - /** - * The Copy Incremental operation copies a snapshot of the source page blob to a destination page blob. The snapshot is copied such that only the differential changes between the previously copied snapshot are transferred to the destination. The copied snapshots are complete copies of the original snapshot and can be read or copied from as usual. This API is supported since REST version 2016-05-31. - * - * @param containerName The container name. - * @param blob The blob name. - * @param copySource Specifies the name of the source page blob snapshot. This value is a URL of up to 2 KB in length that specifies a page blob snapshot. The value should be URL-encoded as it would appear in a request URI. The source blob must either be public or must be authenticated via a shared access signature. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param 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 modifiedAccessConditions Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - public Mono copyIncrementalWithRestResponseAsync(String containerName, String blob, URL copySource, Integer timeout, String requestId, ModifiedAccessConditions modifiedAccessConditions, Context context) { - final String comp = "incrementalcopy"; - OffsetDateTime ifModifiedSince = null; - if (modifiedAccessConditions != null) { - ifModifiedSince = modifiedAccessConditions.ifModifiedSince(); - } - OffsetDateTime ifUnmodifiedSince = null; - if (modifiedAccessConditions != null) { - ifUnmodifiedSince = modifiedAccessConditions.ifUnmodifiedSince(); - } - String ifMatch = null; - if (modifiedAccessConditions != null) { - ifMatch = modifiedAccessConditions.ifMatch(); - } - String ifNoneMatch = null; - if (modifiedAccessConditions != null) { - ifNoneMatch = modifiedAccessConditions.ifNoneMatch(); - } - 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); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java b/storage/client/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java deleted file mode 100644 index a31982006724c..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/implementation/ServicesImpl.java +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -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.util.Context; -import com.azure.storage.blob.models.KeyInfo; -import com.azure.storage.blob.models.ListContainersIncludeType; -import com.azure.storage.blob.models.ServicesGetAccountInfoResponse; -import com.azure.storage.blob.models.ServicesGetPropertiesResponse; -import com.azure.storage.blob.models.ServicesGetStatisticsResponse; -import com.azure.storage.blob.models.ServicesGetUserDelegationKeyResponse; -import com.azure.storage.blob.models.ServicesListContainersSegmentResponse; -import com.azure.storage.blob.models.ServicesSetPropertiesResponse; -import com.azure.storage.blob.models.StorageErrorException; -import com.azure.storage.blob.models.StorageServiceProperties; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in - * Services. - */ -public final class ServicesImpl { - /** - * The proxy service used to perform REST calls. - */ - private ServicesService service; - - /** - * The service client containing this operation class. - */ - private AzureBlobStorageImpl client; - - /** - * Initializes an instance of 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.client = client; - } - - /** - * The interface defining all the services for Services to be used by the - * proxy service to perform REST calls. - */ - @Host("{url}") - @Service("Storage Blobs Service") - private interface ServicesService { - @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("") - @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("") - @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("") - @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("") - @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("") - @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); - } - - /** - * 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 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. - */ - 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); - } - - /** - * 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 timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param 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. - */ - 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); - } - - /** - * gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. - * - * @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. - */ - 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); - } - - /** - * gets the properties of a storage account's Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. - * - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param 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. - */ - 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); - } - - /** - * Retrieves statistics related to replication for the Blob service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account. - * - * @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. - */ - 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); - } - - /** - * Retrieves statistics related to replication for the Blob service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account. - * - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param 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. - */ - 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); - } - - /** - * The List Containers Segment operation returns a list of the containers under the specified account. - * - * @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. - */ - public Mono listContainersSegmentWithRestResponseAsync(Context context) { - final String prefix = null; - final String marker = null; - final Integer maxresults = null; - final ListContainersIncludeType include = null; - 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); - } - - /** - * The List Containers Segment operation returns a list of the containers under the specified account. - * - * @param prefix Filters the results to return only containers whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the client. - * @param maxresults Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the container's metadata be returned as part of the response body. Possible values include: 'metadata'. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param 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. - */ - 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); - } - - /** - * Retrieves a user delgation key for the Blob service. This is only a valid operation when using bearer token authentication. - * - * @param keyInfo the KeyInfo value. - * @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. - */ - 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); - } - - /** - * Retrieves a user delgation key for the Blob service. This is only a valid operation when using bearer token authentication. - * - * @param keyInfo the KeyInfo value. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>. - * @param 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. - */ - 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); - } - - /** - * Returns the sku name and account kind. - * - * @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. - */ - 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); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/implementation/SignedIdentifiersWrapper.java b/storage/client/src/main/java/com/azure/storage/blob/implementation/SignedIdentifiersWrapper.java deleted file mode 100644 index f431e1fe84a19..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/implementation/SignedIdentifiersWrapper.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.implementation; - -import com.azure.storage.blob.models.SignedIdentifier; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.List; - -/** - * A wrapper around List<SignedIdentifier> which provides top-level metadata for serialization. - */ -@JacksonXmlRootElement(localName = "SignedIdentifiers") -public final class SignedIdentifiersWrapper { - @JacksonXmlProperty(localName = "SignedIdentifiers") - private final List signedIdentifiers; - - /** - * Creates an instance of SignedIdentifiersWrapper. - * - * @param signedIdentifiers the list. - */ - @JsonCreator - public SignedIdentifiersWrapper(@JsonProperty("SignedIdentifiers") List signedIdentifiers) { - this.signedIdentifiers = signedIdentifiers; - } - - /** - * Get the List<SignedIdentifier> contained in this wrapper. - * - * @return the List<SignedIdentifier>. - */ - public List items() { - return signedIdentifiers; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/implementation/package-info.java b/storage/client/src/main/java/com/azure/storage/blob/implementation/package-info.java deleted file mode 100644 index 5f341b8ad1be0..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/implementation/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -/** - * This package contains the implementations and inner classes for - * AzureBlobStorage. - */ -package com.azure.storage.blob.implementation; diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/AccessPolicy.java b/storage/client/src/main/java/com/azure/storage/blob/models/AccessPolicy.java deleted file mode 100644 index 8b33f24bf5714..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/AccessPolicy.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * An Access policy. - */ -@JacksonXmlRootElement(localName = "AccessPolicy") -public final class AccessPolicy { - /* - * the date-time the policy is active - */ - @JsonProperty(value = "Start", required = true) - private OffsetDateTime start; - - /* - * the date-time the policy expires - */ - @JsonProperty(value = "Expiry", required = true) - private OffsetDateTime expiry; - - /* - * the permissions for the acl policy - */ - @JsonProperty(value = "Permission", required = true) - private String permission; - - /** - * Get the start property: the date-time the policy is active. - * - * @return the start value. - */ - public OffsetDateTime start() { - return this.start; - } - - /** - * Set the start property: the date-time the policy is active. - * - * @param start the start value to set. - * @return the AccessPolicy object itself. - */ - public AccessPolicy start(OffsetDateTime start) { - this.start = start; - return this; - } - - /** - * Get the expiry property: the date-time the policy expires. - * - * @return the expiry value. - */ - public OffsetDateTime expiry() { - return this.expiry; - } - - /** - * Set the expiry property: the date-time the policy expires. - * - * @param expiry the expiry value to set. - * @return the AccessPolicy object itself. - */ - public AccessPolicy expiry(OffsetDateTime expiry) { - this.expiry = expiry; - return this; - } - - /** - * Get the permission property: the permissions for the acl policy. - * - * @return the permission value. - */ - public String permission() { - return this.permission; - } - - /** - * Set the permission property: the permissions for the acl policy. - * - * @param permission the permission value to set. - * @return the AccessPolicy object itself. - */ - public AccessPolicy permission(String permission) { - this.permission = permission; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/AccessTier.java b/storage/client/src/main/java/com/azure/storage/blob/models/AccessTier.java deleted file mode 100644 index d916bd851ce46..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/AccessTier.java +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** - * Defines values for AccessTier. - */ -public final class AccessTier extends ExpandableStringEnum { - /** - * Static value P4 for AccessTier. - */ - public static final AccessTier P4 = fromString("P4"); - - /** - * Static value P6 for AccessTier. - */ - public static final AccessTier P6 = fromString("P6"); - - /** - * Static value P10 for AccessTier. - */ - public static final AccessTier P10 = fromString("P10"); - - /** - * Static value P20 for AccessTier. - */ - public static final AccessTier P20 = fromString("P20"); - - /** - * Static value P30 for AccessTier. - */ - public static final AccessTier P30 = fromString("P30"); - - /** - * Static value P40 for AccessTier. - */ - public static final AccessTier P40 = fromString("P40"); - - /** - * Static value P50 for AccessTier. - */ - public static final AccessTier P50 = fromString("P50"); - - /** - * Static value Hot for AccessTier. - */ - public static final AccessTier HOT = fromString("Hot"); - - /** - * Static value Cool for AccessTier. - */ - public static final AccessTier COOL = fromString("Cool"); - - /** - * Static value Archive for AccessTier. - */ - public static final AccessTier ARCHIVE = fromString("Archive"); - - /** - * Creates or finds a AccessTier from its string representation. - * - * @param name a name to look for. - * @return the corresponding AccessTier. - */ - @JsonCreator - public static AccessTier fromString(String name) { - return fromString(name, AccessTier.class); - } - - /** - * @return known AccessTier values. - */ - public static Collection values() { - return values(AccessTier.class); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/AccountKind.java b/storage/client/src/main/java/com/azure/storage/blob/models/AccountKind.java deleted file mode 100644 index 72ce1183886ec..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/AccountKind.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for AccountKind. - */ -public enum AccountKind { - /** - * Enum value Storage. - */ - STORAGE("Storage"), - - /** - * Enum value BlobStorage. - */ - BLOB_STORAGE("BlobStorage"), - - /** - * Enum value StorageV2. - */ - STORAGE_V2("StorageV2"); - - /** - * The actual serialized value for a AccountKind instance. - */ - private final String value; - - AccountKind(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a AccountKind instance. - * - * @param value the serialized value to parse. - * @return the parsed AccountKind object, or null if unable to parse. - */ - @JsonCreator - public static AccountKind fromString(String value) { - AccountKind[] items = AccountKind.values(); - for (AccountKind item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java deleted file mode 100644 index 8273338cb6676..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockFromUrlHeaders.java +++ /dev/null @@ -1,305 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.azure.core.implementation.util.ImplUtils; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for AppendBlockFromUrl operation. - */ -@JacksonXmlRootElement(localName = "AppendBlob-AppendBlockFromUrl-Headers") -public final class AppendBlobAppendBlockFromUrlHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. - */ - @JsonProperty(value = "Content-MD5") - private byte[] contentMD5; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * This response header is returned only for append operations. It returns - * the offset at which the block was committed, in bytes. - */ - @JsonProperty(value = "x-ms-blob-append-offset") - private String blobAppendOffset; - - /* - * The number of committed blocks present in the blob. This header is - * returned only for append blobs. - */ - @JsonProperty(value = "x-ms-blob-committed-block-count") - private Integer blobCommittedBlockCount; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the AppendBlobAppendBlockFromUrlHeaders object itself. - */ - public AppendBlobAppendBlockFromUrlHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the AppendBlobAppendBlockFromUrlHeaders object itself. - */ - public AppendBlobAppendBlockFromUrlHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @return the contentMD5 value. - */ - public byte[] contentMD5() { - return ImplUtils.clone(this.contentMD5); - } - - /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @param contentMD5 the contentMD5 value to set. - * @return the AppendBlobAppendBlockFromUrlHeaders object itself. - */ - public AppendBlobAppendBlockFromUrlHeaders contentMD5(byte[] contentMD5) { - this.contentMD5 = ImplUtils.clone(contentMD5); - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the AppendBlobAppendBlockFromUrlHeaders object itself. - */ - public AppendBlobAppendBlockFromUrlHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the AppendBlobAppendBlockFromUrlHeaders object itself. - */ - public AppendBlobAppendBlockFromUrlHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the AppendBlobAppendBlockFromUrlHeaders object itself. - */ - public AppendBlobAppendBlockFromUrlHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the blobAppendOffset property: This response header is returned only - * for append operations. It returns the offset at which the block was - * committed, in bytes. - * - * @return the blobAppendOffset value. - */ - public String blobAppendOffset() { - return this.blobAppendOffset; - } - - /** - * Set the blobAppendOffset property: This response header is returned only - * for append operations. It returns the offset at which the block was - * committed, in bytes. - * - * @param blobAppendOffset the blobAppendOffset value to set. - * @return the AppendBlobAppendBlockFromUrlHeaders object itself. - */ - public AppendBlobAppendBlockFromUrlHeaders blobAppendOffset(String blobAppendOffset) { - this.blobAppendOffset = blobAppendOffset; - return this; - } - - /** - * Get the blobCommittedBlockCount property: The number of committed blocks - * present in the blob. This header is returned only for append blobs. - * - * @return the blobCommittedBlockCount value. - */ - public Integer blobCommittedBlockCount() { - return this.blobCommittedBlockCount; - } - - /** - * Set the blobCommittedBlockCount property: The number of committed blocks - * present in the blob. This header is returned only for append blobs. - * - * @param blobCommittedBlockCount the blobCommittedBlockCount value to set. - * @return the AppendBlobAppendBlockFromUrlHeaders object itself. - */ - public AppendBlobAppendBlockFromUrlHeaders blobCommittedBlockCount(Integer blobCommittedBlockCount) { - this.blobCommittedBlockCount = blobCommittedBlockCount; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the AppendBlobAppendBlockFromUrlHeaders object itself. - */ - public AppendBlobAppendBlockFromUrlHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java deleted file mode 100644 index 8fe788378e589..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobAppendBlockHeaders.java +++ /dev/null @@ -1,369 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.azure.core.implementation.util.ImplUtils; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for AppendBlock operation. - */ -@JacksonXmlRootElement(localName = "AppendBlob-AppendBlock-Headers") -public final class AppendBlobAppendBlockHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. - */ - @JsonProperty(value = "Content-MD5") - private byte[] contentMD5; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * This response header is returned only for append operations. It returns - * the offset at which the block was committed, in bytes. - */ - @JsonProperty(value = "x-ms-blob-append-offset") - private String blobAppendOffset; - - /* - * The number of committed blocks present in the blob. This header is - * returned only for append blobs. - */ - @JsonProperty(value = "x-ms-blob-committed-block-count") - private Integer blobCommittedBlockCount; - - /* - * The value of this header is set to true if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. - */ - @JsonProperty(value = "x-ms-request-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The SHA-256 hash of the encryption key used to encrypt the block. This - * header is only returned when the block was encrypted with a - * customer-provided key. - */ - @JsonProperty(value = "x-ms-encryption-key-sha256") - private String encryptionKeySha256; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the AppendBlobAppendBlockHeaders object itself. - */ - public AppendBlobAppendBlockHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the AppendBlobAppendBlockHeaders object itself. - */ - public AppendBlobAppendBlockHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @return the contentMD5 value. - */ - public byte[] contentMD5() { - return ImplUtils.clone(this.contentMD5); - } - - /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @param contentMD5 the contentMD5 value to set. - * @return the AppendBlobAppendBlockHeaders object itself. - */ - public AppendBlobAppendBlockHeaders contentMD5(byte[] contentMD5) { - this.contentMD5 = ImplUtils.clone(contentMD5); - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the AppendBlobAppendBlockHeaders object itself. - */ - public AppendBlobAppendBlockHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the AppendBlobAppendBlockHeaders object itself. - */ - public AppendBlobAppendBlockHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the AppendBlobAppendBlockHeaders object itself. - */ - public AppendBlobAppendBlockHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the blobAppendOffset property: This response header is returned only - * for append operations. It returns the offset at which the block was - * committed, in bytes. - * - * @return the blobAppendOffset value. - */ - public String blobAppendOffset() { - return this.blobAppendOffset; - } - - /** - * Set the blobAppendOffset property: This response header is returned only - * for append operations. It returns the offset at which the block was - * committed, in bytes. - * - * @param blobAppendOffset the blobAppendOffset value to set. - * @return the AppendBlobAppendBlockHeaders object itself. - */ - public AppendBlobAppendBlockHeaders blobAppendOffset(String blobAppendOffset) { - this.blobAppendOffset = blobAppendOffset; - return this; - } - - /** - * Get the blobCommittedBlockCount property: The number of committed blocks - * present in the blob. This header is returned only for append blobs. - * - * @return the blobCommittedBlockCount value. - */ - public Integer blobCommittedBlockCount() { - return this.blobCommittedBlockCount; - } - - /** - * Set the blobCommittedBlockCount property: The number of committed blocks - * present in the blob. This header is returned only for append blobs. - * - * @param blobCommittedBlockCount the blobCommittedBlockCount value to set. - * @return the AppendBlobAppendBlockHeaders object itself. - */ - public AppendBlobAppendBlockHeaders blobCommittedBlockCount(Integer blobCommittedBlockCount) { - this.blobCommittedBlockCount = blobCommittedBlockCount; - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the AppendBlobAppendBlockHeaders object itself. - */ - public AppendBlobAppendBlockHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the block. This header is only returned when the - * block was encrypted with a customer-provided key. - * - * @return the encryptionKeySha256 value. - */ - public String encryptionKeySha256() { - return this.encryptionKeySha256; - } - - /** - * Set the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the block. This header is only returned when the - * block was encrypted with a customer-provided key. - * - * @param encryptionKeySha256 the encryptionKeySha256 value to set. - * @return the AppendBlobAppendBlockHeaders object itself. - */ - public AppendBlobAppendBlockHeaders encryptionKeySha256(String encryptionKeySha256) { - this.encryptionKeySha256 = encryptionKeySha256; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the AppendBlobAppendBlockHeaders object itself. - */ - public AppendBlobAppendBlockHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobCreateHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobCreateHeaders.java deleted file mode 100644 index 45fd447bde387..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobCreateHeaders.java +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.azure.core.implementation.util.ImplUtils; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Create operation. - */ -@JacksonXmlRootElement(localName = "AppendBlob-Create-Headers") -public final class AppendBlobCreateHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. - */ - @JsonProperty(value = "Content-MD5") - private byte[] contentMD5; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that identifies a version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The value of this header is set to true if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. - */ - @JsonProperty(value = "x-ms-request-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The SHA-256 hash of the encryption key used to encrypt the blob. This - * header is only returned when the blob was encrypted with a - * customer-provided key. - */ - @JsonProperty(value = "x-ms-encryption-key-sha256") - private String encryptionKeySha256; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the AppendBlobCreateHeaders object itself. - */ - public AppendBlobCreateHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the AppendBlobCreateHeaders object itself. - */ - public AppendBlobCreateHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @return the contentMD5 value. - */ - public byte[] contentMD5() { - return ImplUtils.clone(this.contentMD5); - } - - /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @param contentMD5 the contentMD5 value to set. - * @return the AppendBlobCreateHeaders object itself. - */ - public AppendBlobCreateHeaders contentMD5(byte[] contentMD5) { - this.contentMD5 = ImplUtils.clone(contentMD5); - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the AppendBlobCreateHeaders object itself. - */ - public AppendBlobCreateHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the AppendBlobCreateHeaders object itself. - */ - public AppendBlobCreateHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the AppendBlobCreateHeaders object itself. - */ - public AppendBlobCreateHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the AppendBlobCreateHeaders object itself. - */ - public AppendBlobCreateHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the AppendBlobCreateHeaders object itself. - */ - public AppendBlobCreateHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the blob. This header is only returned when the blob - * was encrypted with a customer-provided key. - * - * @return the encryptionKeySha256 value. - */ - public String encryptionKeySha256() { - return this.encryptionKeySha256; - } - - /** - * Set the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the blob. This header is only returned when the blob - * was encrypted with a customer-provided key. - * - * @param encryptionKeySha256 the encryptionKeySha256 value to set. - * @return the AppendBlobCreateHeaders object itself. - */ - public AppendBlobCreateHeaders encryptionKeySha256(String encryptionKeySha256) { - this.encryptionKeySha256 = encryptionKeySha256; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the AppendBlobCreateHeaders object itself. - */ - public AppendBlobCreateHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobsAppendBlockFromUrlResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobsAppendBlockFromUrlResponse.java deleted file mode 100644 index 55cf1e763dc97..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobsAppendBlockFromUrlResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the appendBlockFromUrl operation. - */ -public final class AppendBlobsAppendBlockFromUrlResponse extends ResponseBase { - /** - * Creates an instance of AppendBlobsAppendBlockFromUrlResponse. - * - * @param request the request which resulted in this AppendBlobsAppendBlockFromUrlResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public AppendBlobsAppendBlockFromUrlResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, AppendBlobAppendBlockFromUrlHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobsAppendBlockResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobsAppendBlockResponse.java deleted file mode 100644 index 2dc53c0da52d0..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobsAppendBlockResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the appendBlock operation. - */ -public final class AppendBlobsAppendBlockResponse extends ResponseBase { - /** - * Creates an instance of AppendBlobsAppendBlockResponse. - * - * @param request the request which resulted in this AppendBlobsAppendBlockResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public AppendBlobsAppendBlockResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, AppendBlobAppendBlockHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobsCreateResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobsCreateResponse.java deleted file mode 100644 index c8f4cd830c9f8..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/AppendBlobsCreateResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the create operation. - */ -public final class AppendBlobsCreateResponse extends ResponseBase { - /** - * Creates an instance of AppendBlobsCreateResponse. - * - * @param request the request which resulted in this AppendBlobsCreateResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public AppendBlobsCreateResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, AppendBlobCreateHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/AppendPositionAccessConditions.java b/storage/client/src/main/java/com/azure/storage/blob/models/AppendPositionAccessConditions.java deleted file mode 100644 index 5894e08f86e36..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/AppendPositionAccessConditions.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Additional parameters for a set of operations, such as: - * AppendBlobs_appendBlock, AppendBlobs_appendBlockFromUrl. - */ -@JacksonXmlRootElement(localName = "append-position-access-conditions") -public final class AppendPositionAccessConditions { - /* - * Optional conditional header. The max length in bytes permitted for the - * append blob. If the Append Block operation would cause the blob to - * exceed that limit or if the blob size is already greater than the value - * specified in this header, the request will fail with - * MaxBlobSizeConditionNotMet error (HTTP status code 412 - Precondition - * Failed). - */ - @JsonProperty(value = "maxSize") - private Long maxSize; - - /* - * Optional conditional header, used only for the Append Block operation. A - * number indicating the byte offset to compare. Append Block will succeed - * only if the append position is equal to this number. If it is not, the - * request will fail with the AppendPositionConditionNotMet error (HTTP - * status code 412 - Precondition Failed). - */ - @JsonProperty(value = "appendPosition") - private Long appendPosition; - - /** - * Get the maxSize property: Optional conditional header. The max length in - * bytes permitted for the append blob. If the Append Block operation would - * cause the blob to exceed that limit or if the blob size is already - * greater than the value specified in this header, the request will fail - * with MaxBlobSizeConditionNotMet error (HTTP status code 412 - - * Precondition Failed). - * - * @return the maxSize value. - */ - public Long maxSize() { - return this.maxSize; - } - - /** - * Set the maxSize property: Optional conditional header. The max length in - * bytes permitted for the append blob. If the Append Block operation would - * cause the blob to exceed that limit or if the blob size is already - * greater than the value specified in this header, the request will fail - * with MaxBlobSizeConditionNotMet error (HTTP status code 412 - - * Precondition Failed). - * - * @param maxSize the maxSize value to set. - * @return the AppendPositionAccessConditions object itself. - */ - public AppendPositionAccessConditions maxSize(Long maxSize) { - this.maxSize = maxSize; - return this; - } - - /** - * Get the appendPosition property: Optional conditional header, used only - * for the Append Block operation. A number indicating the byte offset to - * compare. Append Block will succeed only if the append position is equal - * to this number. If it is not, the request will fail with the - * AppendPositionConditionNotMet error (HTTP status code 412 - Precondition - * Failed). - * - * @return the appendPosition value. - */ - public Long appendPosition() { - return this.appendPosition; - } - - /** - * Set the appendPosition property: Optional conditional header, used only - * for the Append Block operation. A number indicating the byte offset to - * compare. Append Block will succeed only if the append position is equal - * to this number. If it is not, the request will fail with the - * AppendPositionConditionNotMet error (HTTP status code 412 - Precondition - * Failed). - * - * @param appendPosition the appendPosition value to set. - * @return the AppendPositionAccessConditions object itself. - */ - public AppendPositionAccessConditions appendPosition(Long appendPosition) { - this.appendPosition = appendPosition; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ArchiveStatus.java b/storage/client/src/main/java/com/azure/storage/blob/models/ArchiveStatus.java deleted file mode 100644 index 5bf03bde28dfa..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ArchiveStatus.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** - * Defines values for ArchiveStatus. - */ -public final class ArchiveStatus extends ExpandableStringEnum { - /** - * Static value rehydrate-pending-to-hot for ArchiveStatus. - */ - public static final ArchiveStatus REHYDRATE_PENDING_TO_HOT = fromString("rehydrate-pending-to-hot"); - - /** - * Static value rehydrate-pending-to-cool for ArchiveStatus. - */ - public static final ArchiveStatus REHYDRATE_PENDING_TO_COOL = fromString("rehydrate-pending-to-cool"); - - /** - * Creates or finds a ArchiveStatus from its string representation. - * - * @param name a name to look for. - * @return the corresponding ArchiveStatus. - */ - @JsonCreator - public static ArchiveStatus fromString(String name) { - return fromString(name, ArchiveStatus.class); - } - - /** - * @return known ArchiveStatus values. - */ - public static Collection values() { - return values(ArchiveStatus.class); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java deleted file mode 100644 index e439f5b8b0892..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobAbortCopyFromURLHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for AbortCopyFromURL operation. - */ -@JacksonXmlRootElement(localName = "Blob-AbortCopyFromURL-Headers") -public final class BlobAbortCopyFromURLHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlobAbortCopyFromURLHeaders object itself. - */ - public BlobAbortCopyFromURLHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlobAbortCopyFromURLHeaders object itself. - */ - public BlobAbortCopyFromURLHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlobAbortCopyFromURLHeaders object itself. - */ - public BlobAbortCopyFromURLHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlobAbortCopyFromURLHeaders object itself. - */ - public BlobAbortCopyFromURLHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobAcquireLeaseHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobAcquireLeaseHeaders.java deleted file mode 100644 index 5bf6ef2560117..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobAcquireLeaseHeaders.java +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for AcquireLease operation. - */ -@JacksonXmlRootElement(localName = "Blob-AcquireLease-Headers") -public final class BlobAcquireLeaseHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the blob was last modified. Any operation that - * modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * Uniquely identifies a blobs's lease - */ - @JsonProperty(value = "x-ms-lease-id") - private String leaseId; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the BlobAcquireLeaseHeaders object itself. - */ - public BlobAcquireLeaseHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the blob was - * last modified. Any operation that modifies the blob, including an update - * of the blob's metadata or properties, changes the last-modified time of - * the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the blob was - * last modified. Any operation that modifies the blob, including an update - * of the blob's metadata or properties, changes the last-modified time of - * the blob. - * - * @param lastModified the lastModified value to set. - * @return the BlobAcquireLeaseHeaders object itself. - */ - public BlobAcquireLeaseHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the leaseId property: Uniquely identifies a blobs's lease. - * - * @return the leaseId value. - */ - public String leaseId() { - return this.leaseId; - } - - /** - * Set the leaseId property: Uniquely identifies a blobs's lease. - * - * @param leaseId the leaseId value to set. - * @return the BlobAcquireLeaseHeaders object itself. - */ - public BlobAcquireLeaseHeaders leaseId(String leaseId) { - this.leaseId = leaseId; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlobAcquireLeaseHeaders object itself. - */ - public BlobAcquireLeaseHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlobAcquireLeaseHeaders object itself. - */ - public BlobAcquireLeaseHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlobAcquireLeaseHeaders object itself. - */ - public BlobAcquireLeaseHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlobAcquireLeaseHeaders object itself. - */ - public BlobAcquireLeaseHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobBreakLeaseHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobBreakLeaseHeaders.java deleted file mode 100644 index b136802ce69ad..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobBreakLeaseHeaders.java +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for BreakLease operation. - */ -@JacksonXmlRootElement(localName = "Blob-BreakLease-Headers") -public final class BlobBreakLeaseHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the blob was last modified. Any operation that - * modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * Approximate time remaining in the lease period, in seconds. - */ - @JsonProperty(value = "x-ms-lease-time") - private Integer leaseTime; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the BlobBreakLeaseHeaders object itself. - */ - public BlobBreakLeaseHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the blob was - * last modified. Any operation that modifies the blob, including an update - * of the blob's metadata or properties, changes the last-modified time of - * the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the blob was - * last modified. Any operation that modifies the blob, including an update - * of the blob's metadata or properties, changes the last-modified time of - * the blob. - * - * @param lastModified the lastModified value to set. - * @return the BlobBreakLeaseHeaders object itself. - */ - public BlobBreakLeaseHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the leaseTime property: Approximate time remaining in the lease - * period, in seconds. - * - * @return the leaseTime value. - */ - public Integer leaseTime() { - return this.leaseTime; - } - - /** - * Set the leaseTime property: Approximate time remaining in the lease - * period, in seconds. - * - * @param leaseTime the leaseTime value to set. - * @return the BlobBreakLeaseHeaders object itself. - */ - public BlobBreakLeaseHeaders leaseTime(Integer leaseTime) { - this.leaseTime = leaseTime; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlobBreakLeaseHeaders object itself. - */ - public BlobBreakLeaseHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlobBreakLeaseHeaders object itself. - */ - public BlobBreakLeaseHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlobBreakLeaseHeaders object itself. - */ - public BlobBreakLeaseHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlobBreakLeaseHeaders object itself. - */ - public BlobBreakLeaseHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobChangeLeaseHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobChangeLeaseHeaders.java deleted file mode 100644 index 1c3010861eaf0..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobChangeLeaseHeaders.java +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for ChangeLease operation. - */ -@JacksonXmlRootElement(localName = "Blob-ChangeLease-Headers") -public final class BlobChangeLeaseHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the blob was last modified. Any operation that - * modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Uniquely identifies a blobs's lease - */ - @JsonProperty(value = "x-ms-lease-id") - private String leaseId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the BlobChangeLeaseHeaders object itself. - */ - public BlobChangeLeaseHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the blob was - * last modified. Any operation that modifies the blob, including an update - * of the blob's metadata or properties, changes the last-modified time of - * the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the blob was - * last modified. Any operation that modifies the blob, including an update - * of the blob's metadata or properties, changes the last-modified time of - * the blob. - * - * @param lastModified the lastModified value to set. - * @return the BlobChangeLeaseHeaders object itself. - */ - public BlobChangeLeaseHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlobChangeLeaseHeaders object itself. - */ - public BlobChangeLeaseHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the leaseId property: Uniquely identifies a blobs's lease. - * - * @return the leaseId value. - */ - public String leaseId() { - return this.leaseId; - } - - /** - * Set the leaseId property: Uniquely identifies a blobs's lease. - * - * @param leaseId the leaseId value to set. - * @return the BlobChangeLeaseHeaders object itself. - */ - public BlobChangeLeaseHeaders leaseId(String leaseId) { - this.leaseId = leaseId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlobChangeLeaseHeaders object itself. - */ - public BlobChangeLeaseHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlobChangeLeaseHeaders object itself. - */ - public BlobChangeLeaseHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlobChangeLeaseHeaders object itself. - */ - public BlobChangeLeaseHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobCopyFromURLHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobCopyFromURLHeaders.java deleted file mode 100644 index 2568e1c566bcf..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobCopyFromURLHeaders.java +++ /dev/null @@ -1,299 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for CopyFromURL operation. - */ -@JacksonXmlRootElement(localName = "Blob-CopyFromURL-Headers") -public final class BlobCopyFromURLHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that identifies the version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * String identifier for this copy operation. - */ - @JsonProperty(value = "x-ms-copy-id") - private String copyId; - - /* - * State of the copy operation identified by x-ms-copy-id. Possible values - * include: 'success' - */ - @JsonProperty(value = "x-ms-copy-status") - private SyncCopyStatusType copyStatus; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the BlobCopyFromURLHeaders object itself. - */ - public BlobCopyFromURLHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the BlobCopyFromURLHeaders object itself. - */ - public BlobCopyFromURLHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlobCopyFromURLHeaders object itself. - */ - public BlobCopyFromURLHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlobCopyFromURLHeaders object itself. - */ - public BlobCopyFromURLHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the BlobCopyFromURLHeaders object itself. - */ - public BlobCopyFromURLHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlobCopyFromURLHeaders object itself. - */ - public BlobCopyFromURLHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the copyId property: String identifier for this copy operation. - * - * @return the copyId value. - */ - public String copyId() { - return this.copyId; - } - - /** - * Set the copyId property: String identifier for this copy operation. - * - * @param copyId the copyId value to set. - * @return the BlobCopyFromURLHeaders object itself. - */ - public BlobCopyFromURLHeaders copyId(String copyId) { - this.copyId = copyId; - return this; - } - - /** - * Get the copyStatus property: State of the copy operation identified by - * x-ms-copy-id. Possible values include: 'success'. - * - * @return the copyStatus value. - */ - public SyncCopyStatusType copyStatus() { - return this.copyStatus; - } - - /** - * Set the copyStatus property: State of the copy operation identified by - * x-ms-copy-id. Possible values include: 'success'. - * - * @param copyStatus the copyStatus value to set. - * @return the BlobCopyFromURLHeaders object itself. - */ - public BlobCopyFromURLHeaders copyStatus(SyncCopyStatusType copyStatus) { - this.copyStatus = copyStatus; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlobCopyFromURLHeaders object itself. - */ - public BlobCopyFromURLHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobCreateSnapshotHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobCreateSnapshotHeaders.java deleted file mode 100644 index f185a465e483e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobCreateSnapshotHeaders.java +++ /dev/null @@ -1,344 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for CreateSnapshot operation. - */ -@JacksonXmlRootElement(localName = "Blob-CreateSnapshot-Headers") -public final class BlobCreateSnapshotHeaders { - /* - * Uniquely identifies the snapshot and indicates the snapshot version. It - * may be used in subsequent requests to access the snapshot - */ - @JsonProperty(value = "x-ms-snapshot") - private String snapshot; - - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that identifies the version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * True if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. For a snapshot request, this - * header is set to true when metadata was provided in the request and - * encrypted with a customer-provided key. - */ - @JsonProperty(value = "x-ms-request-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The SHA-256 hash of the encryption key used to encrypt the source blob. - * This header is only returned when the blob was encrypted with a - * customer-provided key. - */ - @JsonProperty(value = "x-ms-encryption-key-sha256") - private String encryptionKeySha256; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the snapshot property: Uniquely identifies the snapshot and - * indicates the snapshot version. It may be used in subsequent requests to - * access the snapshot. - * - * @return the snapshot value. - */ - public String snapshot() { - return this.snapshot; - } - - /** - * Set the snapshot property: Uniquely identifies the snapshot and - * indicates the snapshot version. It may be used in subsequent requests to - * access the snapshot. - * - * @param snapshot the snapshot value to set. - * @return the BlobCreateSnapshotHeaders object itself. - */ - public BlobCreateSnapshotHeaders snapshot(String snapshot) { - this.snapshot = snapshot; - return this; - } - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the BlobCreateSnapshotHeaders object itself. - */ - public BlobCreateSnapshotHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the BlobCreateSnapshotHeaders object itself. - */ - public BlobCreateSnapshotHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlobCreateSnapshotHeaders object itself. - */ - public BlobCreateSnapshotHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlobCreateSnapshotHeaders object itself. - */ - public BlobCreateSnapshotHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the BlobCreateSnapshotHeaders object itself. - */ - public BlobCreateSnapshotHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlobCreateSnapshotHeaders object itself. - */ - public BlobCreateSnapshotHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the isServerEncrypted property: True if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. For a snapshot request, this header is set to true when - * metadata was provided in the request and encrypted with a - * customer-provided key. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: True if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. For a snapshot request, this header is set to true when - * metadata was provided in the request and encrypted with a - * customer-provided key. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the BlobCreateSnapshotHeaders object itself. - */ - public BlobCreateSnapshotHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the source blob. This header is only returned when - * the blob was encrypted with a customer-provided key. - * - * @return the encryptionKeySha256 value. - */ - public String encryptionKeySha256() { - return this.encryptionKeySha256; - } - - /** - * Set the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the source blob. This header is only returned when - * the blob was encrypted with a customer-provided key. - * - * @param encryptionKeySha256 the encryptionKeySha256 value to set. - * @return the BlobCreateSnapshotHeaders object itself. - */ - public BlobCreateSnapshotHeaders encryptionKeySha256(String encryptionKeySha256) { - this.encryptionKeySha256 = encryptionKeySha256; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlobCreateSnapshotHeaders object itself. - */ - public BlobCreateSnapshotHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobDeleteHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobDeleteHeaders.java deleted file mode 100644 index 7aeac53bc5a33..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobDeleteHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Delete operation. - */ -@JacksonXmlRootElement(localName = "Blob-Delete-Headers") -public final class BlobDeleteHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlobDeleteHeaders object itself. - */ - public BlobDeleteHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlobDeleteHeaders object itself. - */ - public BlobDeleteHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlobDeleteHeaders object itself. - */ - public BlobDeleteHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlobDeleteHeaders object itself. - */ - public BlobDeleteHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java deleted file mode 100644 index aa56c2e6683c4..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobDownloadHeaders.java +++ /dev/null @@ -1,1043 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.annotations.HeaderCollection; -import com.azure.core.implementation.DateTimeRfc1123; -import com.azure.core.implementation.util.ImplUtils; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; -import java.util.Map; - -/** - * Defines headers for Download operation. - */ -@JacksonXmlRootElement(localName = "Blob-Download-Headers") -public final class BlobDownloadHeaders { - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * The metadata property. - */ - @HeaderCollection("x-ms-meta-") - private Map metadata; - - /* - * The number of bytes present in the response body. - */ - @JsonProperty(value = "Content-Length") - private Long contentLength; - - /* - * The media type of the body of the response. For Download Blob this is - * 'application/octet-stream' - */ - @JsonProperty(value = "Content-Type") - private String contentType; - - /* - * Indicates the range of bytes returned in the event that the client - * requested a subset of the blob by setting the 'Range' request header. - */ - @JsonProperty(value = "Content-Range") - private String contentRange; - - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. - */ - @JsonProperty(value = "Content-MD5") - private byte[] contentMD5; - - /* - * This header returns the value that was specified for the - * Content-Encoding request header - */ - @JsonProperty(value = "Content-Encoding") - private String contentEncoding; - - /* - * This header is returned if it was previously specified for the blob. - */ - @JsonProperty(value = "Cache-Control") - private String cacheControl; - - /* - * This header returns the value that was specified for the - * 'x-ms-blob-content-disposition' header. The Content-Disposition response - * header field conveys additional information about how to process the - * response payload, and also can be used to attach additional metadata. - * For example, if set to attachment, it indicates that the user-agent - * should not display the response, but instead show a Save As dialog with - * a filename other than the blob name specified. - */ - @JsonProperty(value = "Content-Disposition") - private String contentDisposition; - - /* - * This header returns the value that was specified for the - * Content-Language request header. - */ - @JsonProperty(value = "Content-Language") - private String contentLanguage; - - /* - * The current sequence number for a page blob. This header is not returned - * for block blobs or append blobs - */ - @JsonProperty(value = "x-ms-blob-sequence-number") - private Long blobSequenceNumber; - - /* - * The blob's type. Possible values include: 'BlockBlob', 'PageBlob', - * 'AppendBlob' - */ - @JsonProperty(value = "x-ms-blob-type") - private BlobType blobType; - - /* - * Conclusion time of the last attempted Copy Blob operation where this - * blob was the destination blob. This value can specify the time of a - * completed, aborted, or failed copy attempt. This header does not appear - * if a copy is pending, if this blob has never been the destination in a - * Copy Blob operation, or if this blob has been modified after a concluded - * Copy Blob operation using Set Blob Properties, Put Blob, or Put Block - * List. - */ - @JsonProperty(value = "x-ms-copy-completion-time") - private DateTimeRfc1123 copyCompletionTime; - - /* - * Only appears when x-ms-copy-status is failed or pending. Describes the - * cause of the last fatal or non-fatal copy operation failure. This header - * does not appear if this blob has never been the destination in a Copy - * Blob operation, or if this blob has been modified after a concluded Copy - * Blob operation using Set Blob Properties, Put Blob, or Put Block List - */ - @JsonProperty(value = "x-ms-copy-status-description") - private String copyStatusDescription; - - /* - * String identifier for this copy operation. Use with Get Blob Properties - * to check the status of this copy operation, or pass to Abort Copy Blob - * to abort a pending copy. - */ - @JsonProperty(value = "x-ms-copy-id") - private String copyId; - - /* - * Contains the number of bytes copied and the total bytes in the source in - * the last attempted Copy Blob operation where this blob was the - * destination blob. Can show between 0 and Content-Length bytes copied. - * This header does not appear if this blob has never been the destination - * in a Copy Blob operation, or if this blob has been modified after a - * concluded Copy Blob operation using Set Blob Properties, Put Blob, or - * Put Block List - */ - @JsonProperty(value = "x-ms-copy-progress") - private String copyProgress; - - /* - * URL up to 2 KB in length that specifies the source blob or file used in - * the last attempted Copy Blob operation where this blob was the - * destination blob. This header does not appear if this blob has never - * been the destination in a Copy Blob operation, or if this blob has been - * modified after a concluded Copy Blob operation using Set Blob - * Properties, Put Blob, or Put Block List. - */ - @JsonProperty(value = "x-ms-copy-source") - private String copySource; - - /* - * State of the copy operation identified by x-ms-copy-id. Possible values - * include: 'pending', 'success', 'aborted', 'failed' - */ - @JsonProperty(value = "x-ms-copy-status") - private CopyStatusType copyStatus; - - /* - * When a blob is leased, specifies whether the lease is of infinite or - * fixed duration. Possible values include: 'infinite', 'fixed' - */ - @JsonProperty(value = "x-ms-lease-duration") - private LeaseDurationType leaseDuration; - - /* - * Lease state of the blob. Possible values include: 'available', 'leased', - * 'expired', 'breaking', 'broken' - */ - @JsonProperty(value = "x-ms-lease-state") - private LeaseStateType leaseState; - - /* - * The current lease status of the blob. Possible values include: 'locked', - * 'unlocked' - */ - @JsonProperty(value = "x-ms-lease-status") - private LeaseStatusType leaseStatus; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * Indicates that the service supports requests for partial blob content. - */ - @JsonProperty(value = "Accept-Ranges") - private String acceptRanges; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The number of committed blocks present in the blob. This header is - * returned only for append blobs. - */ - @JsonProperty(value = "x-ms-blob-committed-block-count") - private Integer blobCommittedBlockCount; - - /* - * The value of this header is set to true if the blob data and application - * metadata are completely encrypted using the specified algorithm. - * Otherwise, the value is set to false (when the blob is unencrypted, or - * if only parts of the blob/application metadata are encrypted). - */ - @JsonProperty(value = "x-ms-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The SHA-256 hash of the encryption key used to encrypt the blob. This - * header is only returned when the blob was encrypted with a - * customer-provided key. - */ - @JsonProperty(value = "x-ms-encryption-key-sha256") - private String encryptionKeySha256; - - /* - * If the blob has a MD5 hash, and if request contains range header (Range - * or x-ms-range), this response header is returned with the value of the - * whole blob's MD5 value. This value may or may not be equal to the value - * returned in Content-MD5 header, with the latter calculated from the - * requested range - */ - @JsonProperty(value = "x-ms-blob-content-md5") - private byte[] blobContentMD5; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the metadata property: The metadata property. - * - * @return the metadata value. - */ - public Map metadata() { - return this.metadata; - } - - /** - * Set the metadata property: The metadata property. - * - * @param metadata the metadata value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders metadata(Map metadata) { - this.metadata = metadata; - return this; - } - - /** - * Get the contentLength property: The number of bytes present in the - * response body. - * - * @return the contentLength value. - */ - public Long contentLength() { - return this.contentLength; - } - - /** - * Set the contentLength property: The number of bytes present in the - * response body. - * - * @param contentLength the contentLength value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders contentLength(Long contentLength) { - this.contentLength = contentLength; - return this; - } - - /** - * Get the contentType property: The media type of the body of the - * response. For Download Blob this is 'application/octet-stream'. - * - * @return the contentType value. - */ - public String contentType() { - return this.contentType; - } - - /** - * Set the contentType property: The media type of the body of the - * response. For Download Blob this is 'application/octet-stream'. - * - * @param contentType the contentType value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders contentType(String contentType) { - this.contentType = contentType; - return this; - } - - /** - * Get the contentRange property: Indicates the range of bytes returned in - * the event that the client requested a subset of the blob by setting the - * 'Range' request header. - * - * @return the contentRange value. - */ - public String contentRange() { - return this.contentRange; - } - - /** - * Set the contentRange property: Indicates the range of bytes returned in - * the event that the client requested a subset of the blob by setting the - * 'Range' request header. - * - * @param contentRange the contentRange value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders contentRange(String contentRange) { - this.contentRange = contentRange; - return this; - } - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @return the contentMD5 value. - */ - public byte[] contentMD5() { - return ImplUtils.clone(this.contentMD5); - } - - /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @param contentMD5 the contentMD5 value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders contentMD5(byte[] contentMD5) { - this.contentMD5 = ImplUtils.clone(contentMD5); - return this; - } - - /** - * Get the contentEncoding property: This header returns the value that was - * specified for the Content-Encoding request header. - * - * @return the contentEncoding value. - */ - public String contentEncoding() { - return this.contentEncoding; - } - - /** - * Set the contentEncoding property: This header returns the value that was - * specified for the Content-Encoding request header. - * - * @param contentEncoding the contentEncoding value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders contentEncoding(String contentEncoding) { - this.contentEncoding = contentEncoding; - return this; - } - - /** - * Get the cacheControl property: This header is returned if it was - * previously specified for the blob. - * - * @return the cacheControl value. - */ - public String cacheControl() { - return this.cacheControl; - } - - /** - * Set the cacheControl property: This header is returned if it was - * previously specified for the blob. - * - * @param cacheControl the cacheControl value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders cacheControl(String cacheControl) { - this.cacheControl = cacheControl; - return this; - } - - /** - * Get the contentDisposition property: This header returns the value that - * was specified for the 'x-ms-blob-content-disposition' header. The - * Content-Disposition response header field conveys additional information - * about how to process the response payload, and also can be used to - * attach additional metadata. For example, if set to attachment, it - * indicates that the user-agent should not display the response, but - * instead show a Save As dialog with a filename other than the blob name - * specified. - * - * @return the contentDisposition value. - */ - public String contentDisposition() { - return this.contentDisposition; - } - - /** - * Set the contentDisposition property: This header returns the value that - * was specified for the 'x-ms-blob-content-disposition' header. The - * Content-Disposition response header field conveys additional information - * about how to process the response payload, and also can be used to - * attach additional metadata. For example, if set to attachment, it - * indicates that the user-agent should not display the response, but - * instead show a Save As dialog with a filename other than the blob name - * specified. - * - * @param contentDisposition the contentDisposition value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders contentDisposition(String contentDisposition) { - this.contentDisposition = contentDisposition; - return this; - } - - /** - * Get the contentLanguage property: This header returns the value that was - * specified for the Content-Language request header. - * - * @return the contentLanguage value. - */ - public String contentLanguage() { - return this.contentLanguage; - } - - /** - * Set the contentLanguage property: This header returns the value that was - * specified for the Content-Language request header. - * - * @param contentLanguage the contentLanguage value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders contentLanguage(String contentLanguage) { - this.contentLanguage = contentLanguage; - return this; - } - - /** - * Get the blobSequenceNumber property: The current sequence number for a - * page blob. This header is not returned for block blobs or append blobs. - * - * @return the blobSequenceNumber value. - */ - public Long blobSequenceNumber() { - return this.blobSequenceNumber; - } - - /** - * Set the blobSequenceNumber property: The current sequence number for a - * page blob. This header is not returned for block blobs or append blobs. - * - * @param blobSequenceNumber the blobSequenceNumber value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders blobSequenceNumber(Long blobSequenceNumber) { - this.blobSequenceNumber = blobSequenceNumber; - return this; - } - - /** - * Get the blobType property: The blob's type. Possible values include: - * 'BlockBlob', 'PageBlob', 'AppendBlob'. - * - * @return the blobType value. - */ - public BlobType blobType() { - return this.blobType; - } - - /** - * Set the blobType property: The blob's type. Possible values include: - * 'BlockBlob', 'PageBlob', 'AppendBlob'. - * - * @param blobType the blobType value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders blobType(BlobType blobType) { - this.blobType = blobType; - return this; - } - - /** - * Get the copyCompletionTime property: Conclusion time of the last - * attempted Copy Blob operation where this blob was the destination blob. - * This value can specify the time of a completed, aborted, or failed copy - * attempt. This header does not appear if a copy is pending, if this blob - * has never been the destination in a Copy Blob operation, or if this blob - * has been modified after a concluded Copy Blob operation using Set Blob - * Properties, Put Blob, or Put Block List. - * - * @return the copyCompletionTime value. - */ - public OffsetDateTime copyCompletionTime() { - if (this.copyCompletionTime == null) { - return null; - } - return this.copyCompletionTime.dateTime(); - } - - /** - * Set the copyCompletionTime property: Conclusion time of the last - * attempted Copy Blob operation where this blob was the destination blob. - * This value can specify the time of a completed, aborted, or failed copy - * attempt. This header does not appear if a copy is pending, if this blob - * has never been the destination in a Copy Blob operation, or if this blob - * has been modified after a concluded Copy Blob operation using Set Blob - * Properties, Put Blob, or Put Block List. - * - * @param copyCompletionTime the copyCompletionTime value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders copyCompletionTime(OffsetDateTime copyCompletionTime) { - if (copyCompletionTime == null) { - this.copyCompletionTime = null; - } else { - this.copyCompletionTime = new DateTimeRfc1123(copyCompletionTime); - } - return this; - } - - /** - * Get the copyStatusDescription property: Only appears when - * x-ms-copy-status is failed or pending. Describes the cause of the last - * fatal or non-fatal copy operation failure. This header does not appear - * if this blob has never been the destination in a Copy Blob operation, or - * if this blob has been modified after a concluded Copy Blob operation - * using Set Blob Properties, Put Blob, or Put Block List. - * - * @return the copyStatusDescription value. - */ - public String copyStatusDescription() { - return this.copyStatusDescription; - } - - /** - * Set the copyStatusDescription property: Only appears when - * x-ms-copy-status is failed or pending. Describes the cause of the last - * fatal or non-fatal copy operation failure. This header does not appear - * if this blob has never been the destination in a Copy Blob operation, or - * if this blob has been modified after a concluded Copy Blob operation - * using Set Blob Properties, Put Blob, or Put Block List. - * - * @param copyStatusDescription the copyStatusDescription value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders copyStatusDescription(String copyStatusDescription) { - this.copyStatusDescription = copyStatusDescription; - return this; - } - - /** - * Get the copyId property: String identifier for this copy operation. Use - * with Get Blob Properties to check the status of this copy operation, or - * pass to Abort Copy Blob to abort a pending copy. - * - * @return the copyId value. - */ - public String copyId() { - return this.copyId; - } - - /** - * Set the copyId property: String identifier for this copy operation. Use - * with Get Blob Properties to check the status of this copy operation, or - * pass to Abort Copy Blob to abort a pending copy. - * - * @param copyId the copyId value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders copyId(String copyId) { - this.copyId = copyId; - return this; - } - - /** - * Get the copyProgress property: Contains the number of bytes copied and - * the total bytes in the source in the last attempted Copy Blob operation - * where this blob was the destination blob. Can show between 0 and - * Content-Length bytes copied. This header does not appear if this blob - * has never been the destination in a Copy Blob operation, or if this blob - * has been modified after a concluded Copy Blob operation using Set Blob - * Properties, Put Blob, or Put Block List. - * - * @return the copyProgress value. - */ - public String copyProgress() { - return this.copyProgress; - } - - /** - * Set the copyProgress property: Contains the number of bytes copied and - * the total bytes in the source in the last attempted Copy Blob operation - * where this blob was the destination blob. Can show between 0 and - * Content-Length bytes copied. This header does not appear if this blob - * has never been the destination in a Copy Blob operation, or if this blob - * has been modified after a concluded Copy Blob operation using Set Blob - * Properties, Put Blob, or Put Block List. - * - * @param copyProgress the copyProgress value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders copyProgress(String copyProgress) { - this.copyProgress = copyProgress; - return this; - } - - /** - * Get the copySource property: URL up to 2 KB in length that specifies the - * source blob or file used in the last attempted Copy Blob operation where - * this blob was the destination blob. This header does not appear if this - * blob has never been the destination in a Copy Blob operation, or if this - * blob has been modified after a concluded Copy Blob operation using Set - * Blob Properties, Put Blob, or Put Block List. - * - * @return the copySource value. - */ - public String copySource() { - return this.copySource; - } - - /** - * Set the copySource property: URL up to 2 KB in length that specifies the - * source blob or file used in the last attempted Copy Blob operation where - * this blob was the destination blob. This header does not appear if this - * blob has never been the destination in a Copy Blob operation, or if this - * blob has been modified after a concluded Copy Blob operation using Set - * Blob Properties, Put Blob, or Put Block List. - * - * @param copySource the copySource value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders copySource(String copySource) { - this.copySource = copySource; - return this; - } - - /** - * Get the copyStatus property: State of the copy operation identified by - * x-ms-copy-id. Possible values include: 'pending', 'success', 'aborted', - * 'failed'. - * - * @return the copyStatus value. - */ - public CopyStatusType copyStatus() { - return this.copyStatus; - } - - /** - * Set the copyStatus property: State of the copy operation identified by - * x-ms-copy-id. Possible values include: 'pending', 'success', 'aborted', - * 'failed'. - * - * @param copyStatus the copyStatus value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders copyStatus(CopyStatusType copyStatus) { - this.copyStatus = copyStatus; - return this; - } - - /** - * Get the leaseDuration property: When a blob is leased, specifies whether - * the lease is of infinite or fixed duration. Possible values include: - * 'infinite', 'fixed'. - * - * @return the leaseDuration value. - */ - public LeaseDurationType leaseDuration() { - return this.leaseDuration; - } - - /** - * Set the leaseDuration property: When a blob is leased, specifies whether - * the lease is of infinite or fixed duration. Possible values include: - * 'infinite', 'fixed'. - * - * @param leaseDuration the leaseDuration value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders leaseDuration(LeaseDurationType leaseDuration) { - this.leaseDuration = leaseDuration; - return this; - } - - /** - * Get the leaseState property: Lease state of the blob. Possible values - * include: 'available', 'leased', 'expired', 'breaking', 'broken'. - * - * @return the leaseState value. - */ - public LeaseStateType leaseState() { - return this.leaseState; - } - - /** - * Set the leaseState property: Lease state of the blob. Possible values - * include: 'available', 'leased', 'expired', 'breaking', 'broken'. - * - * @param leaseState the leaseState value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders leaseState(LeaseStateType leaseState) { - this.leaseState = leaseState; - return this; - } - - /** - * Get the leaseStatus property: The current lease status of the blob. - * Possible values include: 'locked', 'unlocked'. - * - * @return the leaseStatus value. - */ - public LeaseStatusType leaseStatus() { - return this.leaseStatus; - } - - /** - * Set the leaseStatus property: The current lease status of the blob. - * Possible values include: 'locked', 'unlocked'. - * - * @param leaseStatus the leaseStatus value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders leaseStatus(LeaseStatusType leaseStatus) { - this.leaseStatus = leaseStatus; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the acceptRanges property: Indicates that the service supports - * requests for partial blob content. - * - * @return the acceptRanges value. - */ - public String acceptRanges() { - return this.acceptRanges; - } - - /** - * Set the acceptRanges property: Indicates that the service supports - * requests for partial blob content. - * - * @param acceptRanges the acceptRanges value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders acceptRanges(String acceptRanges) { - this.acceptRanges = acceptRanges; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the blobCommittedBlockCount property: The number of committed blocks - * present in the blob. This header is returned only for append blobs. - * - * @return the blobCommittedBlockCount value. - */ - public Integer blobCommittedBlockCount() { - return this.blobCommittedBlockCount; - } - - /** - * Set the blobCommittedBlockCount property: The number of committed blocks - * present in the blob. This header is returned only for append blobs. - * - * @param blobCommittedBlockCount the blobCommittedBlockCount value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders blobCommittedBlockCount(Integer blobCommittedBlockCount) { - this.blobCommittedBlockCount = blobCommittedBlockCount; - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the blob data and application metadata are completely encrypted - * using the specified algorithm. Otherwise, the value is set to false - * (when the blob is unencrypted, or if only parts of the blob/application - * metadata are encrypted). - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the blob data and application metadata are completely encrypted - * using the specified algorithm. Otherwise, the value is set to false - * (when the blob is unencrypted, or if only parts of the blob/application - * metadata are encrypted). - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the blob. This header is only returned when the blob - * was encrypted with a customer-provided key. - * - * @return the encryptionKeySha256 value. - */ - public String encryptionKeySha256() { - return this.encryptionKeySha256; - } - - /** - * Set the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the blob. This header is only returned when the blob - * was encrypted with a customer-provided key. - * - * @param encryptionKeySha256 the encryptionKeySha256 value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders encryptionKeySha256(String encryptionKeySha256) { - this.encryptionKeySha256 = encryptionKeySha256; - return this; - } - - /** - * Get the blobContentMD5 property: If the blob has a MD5 hash, and if - * request contains range header (Range or x-ms-range), this response - * header is returned with the value of the whole blob's MD5 value. This - * value may or may not be equal to the value returned in Content-MD5 - * header, with the latter calculated from the requested range. - * - * @return the blobContentMD5 value. - */ - public byte[] blobContentMD5() { - return ImplUtils.clone(this.blobContentMD5); - } - - /** - * Set the blobContentMD5 property: If the blob has a MD5 hash, and if - * request contains range header (Range or x-ms-range), this response - * header is returned with the value of the whole blob's MD5 value. This - * value may or may not be equal to the value returned in Content-MD5 - * header, with the latter calculated from the requested range. - * - * @param blobContentMD5 the blobContentMD5 value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders blobContentMD5(byte[] blobContentMD5) { - this.blobContentMD5 = ImplUtils.clone(blobContentMD5); - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlobDownloadHeaders object itself. - */ - public BlobDownloadHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobFlatListSegment.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobFlatListSegment.java deleted file mode 100644 index 97f8e48a9c832..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobFlatListSegment.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.ArrayList; -import java.util.List; - -/** - * The BlobFlatListSegment model. - */ -@JacksonXmlRootElement(localName = "Blobs") -public final class BlobFlatListSegment { - /* - * The blobItems property. - */ - @JsonProperty("Blob") - private List blobItems = new ArrayList<>(); - - /** - * Get the blobItems property: The blobItems property. - * - * @return the blobItems value. - */ - public List blobItems() { - return this.blobItems; - } - - /** - * Set the blobItems property: The blobItems property. - * - * @param blobItems the blobItems value to set. - * @return the BlobFlatListSegment object itself. - */ - public BlobFlatListSegment blobItems(List blobItems) { - this.blobItems = blobItems; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobGetAccountInfoHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobGetAccountInfoHeaders.java deleted file mode 100644 index 81c8b54b46615..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobGetAccountInfoHeaders.java +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for GetAccountInfo operation. - */ -@JacksonXmlRootElement(localName = "Blob-GetAccountInfo-Headers") -public final class BlobGetAccountInfoHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * Identifies the sku name of the account. Possible values include: - * 'Standard_LRS', 'Standard_GRS', 'Standard_RAGRS', 'Standard_ZRS', - * 'Premium_LRS' - */ - @JsonProperty(value = "x-ms-sku-name") - private SkuName skuName; - - /* - * Identifies the account kind. Possible values include: 'Storage', - * 'BlobStorage', 'StorageV2' - */ - @JsonProperty(value = "x-ms-account-kind") - private AccountKind accountKind; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlobGetAccountInfoHeaders object itself. - */ - public BlobGetAccountInfoHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlobGetAccountInfoHeaders object itself. - */ - public BlobGetAccountInfoHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlobGetAccountInfoHeaders object itself. - */ - public BlobGetAccountInfoHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the skuName property: Identifies the sku name of the account. - * Possible values include: 'Standard_LRS', 'Standard_GRS', - * 'Standard_RAGRS', 'Standard_ZRS', 'Premium_LRS'. - * - * @return the skuName value. - */ - public SkuName skuName() { - return this.skuName; - } - - /** - * Set the skuName property: Identifies the sku name of the account. - * Possible values include: 'Standard_LRS', 'Standard_GRS', - * 'Standard_RAGRS', 'Standard_ZRS', 'Premium_LRS'. - * - * @param skuName the skuName value to set. - * @return the BlobGetAccountInfoHeaders object itself. - */ - public BlobGetAccountInfoHeaders skuName(SkuName skuName) { - this.skuName = skuName; - return this; - } - - /** - * Get the accountKind property: Identifies the account kind. Possible - * values include: 'Storage', 'BlobStorage', 'StorageV2'. - * - * @return the accountKind value. - */ - public AccountKind accountKind() { - return this.accountKind; - } - - /** - * Set the accountKind property: Identifies the account kind. Possible - * values include: 'Storage', 'BlobStorage', 'StorageV2'. - * - * @param accountKind the accountKind value to set. - * @return the BlobGetAccountInfoHeaders object itself. - */ - public BlobGetAccountInfoHeaders accountKind(AccountKind accountKind) { - this.accountKind = accountKind; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlobGetAccountInfoHeaders object itself. - */ - public BlobGetAccountInfoHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobGetPropertiesHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobGetPropertiesHeaders.java deleted file mode 100644 index cb1d9e3ba1762..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobGetPropertiesHeaders.java +++ /dev/null @@ -1,1218 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.annotations.HeaderCollection; -import com.azure.core.implementation.DateTimeRfc1123; -import com.azure.core.implementation.util.ImplUtils; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; -import java.util.Map; - -/** - * Defines headers for GetProperties operation. - */ -@JacksonXmlRootElement(localName = "Blob-GetProperties-Headers") -public final class BlobGetPropertiesHeaders { - /* - * Returns the date and time the blob was last modified. Any operation that - * modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * Returns the date and time the blob was created. - */ - @JsonProperty(value = "x-ms-creation-time") - private DateTimeRfc1123 creationTime; - - /* - * The metadata property. - */ - @HeaderCollection("x-ms-meta-") - private Map metadata; - - /* - * The blob's type. Possible values include: 'BlockBlob', 'PageBlob', - * 'AppendBlob' - */ - @JsonProperty(value = "x-ms-blob-type") - private BlobType blobType; - - /* - * Conclusion time of the last attempted Copy Blob operation where this - * blob was the destination blob. This value can specify the time of a - * completed, aborted, or failed copy attempt. This header does not appear - * if a copy is pending, if this blob has never been the destination in a - * Copy Blob operation, or if this blob has been modified after a concluded - * Copy Blob operation using Set Blob Properties, Put Blob, or Put Block - * List. - */ - @JsonProperty(value = "x-ms-copy-completion-time") - private DateTimeRfc1123 copyCompletionTime; - - /* - * Only appears when x-ms-copy-status is failed or pending. Describes the - * cause of the last fatal or non-fatal copy operation failure. This header - * does not appear if this blob has never been the destination in a Copy - * Blob operation, or if this blob has been modified after a concluded Copy - * Blob operation using Set Blob Properties, Put Blob, or Put Block List - */ - @JsonProperty(value = "x-ms-copy-status-description") - private String copyStatusDescription; - - /* - * String identifier for this copy operation. Use with Get Blob Properties - * to check the status of this copy operation, or pass to Abort Copy Blob - * to abort a pending copy. - */ - @JsonProperty(value = "x-ms-copy-id") - private String copyId; - - /* - * Contains the number of bytes copied and the total bytes in the source in - * the last attempted Copy Blob operation where this blob was the - * destination blob. Can show between 0 and Content-Length bytes copied. - * This header does not appear if this blob has never been the destination - * in a Copy Blob operation, or if this blob has been modified after a - * concluded Copy Blob operation using Set Blob Properties, Put Blob, or - * Put Block List - */ - @JsonProperty(value = "x-ms-copy-progress") - private String copyProgress; - - /* - * URL up to 2 KB in length that specifies the source blob or file used in - * the last attempted Copy Blob operation where this blob was the - * destination blob. This header does not appear if this blob has never - * been the destination in a Copy Blob operation, or if this blob has been - * modified after a concluded Copy Blob operation using Set Blob - * Properties, Put Blob, or Put Block List. - */ - @JsonProperty(value = "x-ms-copy-source") - private String copySource; - - /* - * State of the copy operation identified by x-ms-copy-id. Possible values - * include: 'pending', 'success', 'aborted', 'failed' - */ - @JsonProperty(value = "x-ms-copy-status") - private CopyStatusType copyStatus; - - /* - * Included if the blob is incremental copy blob. - */ - @JsonProperty(value = "x-ms-incremental-copy") - private Boolean isIncrementalCopy; - - /* - * Included if the blob is incremental copy blob or incremental copy - * snapshot, if x-ms-copy-status is success. Snapshot time of the last - * successful incremental copy snapshot for this blob. - */ - @JsonProperty(value = "x-ms-copy-destination-snapshot") - private String destinationSnapshot; - - /* - * When a blob is leased, specifies whether the lease is of infinite or - * fixed duration. Possible values include: 'infinite', 'fixed' - */ - @JsonProperty(value = "x-ms-lease-duration") - private LeaseDurationType leaseDuration; - - /* - * Lease state of the blob. Possible values include: 'available', 'leased', - * 'expired', 'breaking', 'broken' - */ - @JsonProperty(value = "x-ms-lease-state") - private LeaseStateType leaseState; - - /* - * The current lease status of the blob. Possible values include: 'locked', - * 'unlocked' - */ - @JsonProperty(value = "x-ms-lease-status") - private LeaseStatusType leaseStatus; - - /* - * The number of bytes present in the response body. - */ - @JsonProperty(value = "Content-Length") - private Long contentLength; - - /* - * The content type specified for the blob. The default content type is - * 'application/octet-stream' - */ - @JsonProperty(value = "Content-Type") - private String contentType; - - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. - */ - @JsonProperty(value = "Content-MD5") - private byte[] contentMD5; - - /* - * This header returns the value that was specified for the - * Content-Encoding request header - */ - @JsonProperty(value = "Content-Encoding") - private String contentEncoding; - - /* - * This header returns the value that was specified for the - * 'x-ms-blob-content-disposition' header. The Content-Disposition response - * header field conveys additional information about how to process the - * response payload, and also can be used to attach additional metadata. - * For example, if set to attachment, it indicates that the user-agent - * should not display the response, but instead show a Save As dialog with - * a filename other than the blob name specified. - */ - @JsonProperty(value = "Content-Disposition") - private String contentDisposition; - - /* - * This header returns the value that was specified for the - * Content-Language request header. - */ - @JsonProperty(value = "Content-Language") - private String contentLanguage; - - /* - * This header is returned if it was previously specified for the blob. - */ - @JsonProperty(value = "Cache-Control") - private String cacheControl; - - /* - * The current sequence number for a page blob. This header is not returned - * for block blobs or append blobs - */ - @JsonProperty(value = "x-ms-blob-sequence-number") - private Long blobSequenceNumber; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * Indicates that the service supports requests for partial blob content. - */ - @JsonProperty(value = "Accept-Ranges") - private String acceptRanges; - - /* - * The number of committed blocks present in the blob. This header is - * returned only for append blobs. - */ - @JsonProperty(value = "x-ms-blob-committed-block-count") - private Integer blobCommittedBlockCount; - - /* - * The value of this header is set to true if the blob data and application - * metadata are completely encrypted using the specified algorithm. - * Otherwise, the value is set to false (when the blob is unencrypted, or - * if only parts of the blob/application metadata are encrypted). - */ - @JsonProperty(value = "x-ms-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The SHA-256 hash of the encryption key used to encrypt the metadata. - * This header is only returned when the metadata was encrypted with a - * customer-provided key. - */ - @JsonProperty(value = "x-ms-encryption-key-sha256") - private String encryptionKeySha256; - - /* - * The tier of page blob on a premium storage account or tier of block blob - * on blob storage LRS accounts. For a list of allowed premium page blob - * tiers, see - * https://docs.microsoft.com/en-us/azure/virtual-machines/windows/premium-storage#features. - * For blob storage LRS accounts, valid values are Hot/Cool/Archive. - */ - @JsonProperty(value = "x-ms-access-tier") - private String accessTier; - - /* - * For page blobs on a premium storage account only. If the access tier is - * not explicitly set on the blob, the tier is inferred based on its - * content length and this header will be returned with true value. - */ - @JsonProperty(value = "x-ms-access-tier-inferred") - private Boolean accessTierInferred; - - /* - * For blob storage LRS accounts, valid values are - * rehydrate-pending-to-hot/rehydrate-pending-to-cool. If the blob is being - * rehydrated and is not complete then this header is returned indicating - * that rehydrate is pending and also tells the destination tier. - */ - @JsonProperty(value = "x-ms-archive-status") - private String archiveStatus; - - /* - * The time the tier was changed on the object. This is only returned if - * the tier on the block blob was ever set. - */ - @JsonProperty(value = "x-ms-access-tier-change-time") - private DateTimeRfc1123 accessTierChangeTime; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the lastModified property: Returns the date and time the blob was - * last modified. Any operation that modifies the blob, including an update - * of the blob's metadata or properties, changes the last-modified time of - * the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the blob was - * last modified. Any operation that modifies the blob, including an update - * of the blob's metadata or properties, changes the last-modified time of - * the blob. - * - * @param lastModified the lastModified value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the creationTime property: Returns the date and time the blob was - * created. - * - * @return the creationTime value. - */ - public OffsetDateTime creationTime() { - if (this.creationTime == null) { - return null; - } - return this.creationTime.dateTime(); - } - - /** - * Set the creationTime property: Returns the date and time the blob was - * created. - * - * @param creationTime the creationTime value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders creationTime(OffsetDateTime creationTime) { - if (creationTime == null) { - this.creationTime = null; - } else { - this.creationTime = new DateTimeRfc1123(creationTime); - } - return this; - } - - /** - * Get the metadata property: The metadata property. - * - * @return the metadata value. - */ - public Map metadata() { - return this.metadata; - } - - /** - * Set the metadata property: The metadata property. - * - * @param metadata the metadata value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders metadata(Map metadata) { - this.metadata = metadata; - return this; - } - - /** - * Get the blobType property: The blob's type. Possible values include: - * 'BlockBlob', 'PageBlob', 'AppendBlob'. - * - * @return the blobType value. - */ - public BlobType blobType() { - return this.blobType; - } - - /** - * Set the blobType property: The blob's type. Possible values include: - * 'BlockBlob', 'PageBlob', 'AppendBlob'. - * - * @param blobType the blobType value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders blobType(BlobType blobType) { - this.blobType = blobType; - return this; - } - - /** - * Get the copyCompletionTime property: Conclusion time of the last - * attempted Copy Blob operation where this blob was the destination blob. - * This value can specify the time of a completed, aborted, or failed copy - * attempt. This header does not appear if a copy is pending, if this blob - * has never been the destination in a Copy Blob operation, or if this blob - * has been modified after a concluded Copy Blob operation using Set Blob - * Properties, Put Blob, or Put Block List. - * - * @return the copyCompletionTime value. - */ - public OffsetDateTime copyCompletionTime() { - if (this.copyCompletionTime == null) { - return null; - } - return this.copyCompletionTime.dateTime(); - } - - /** - * Set the copyCompletionTime property: Conclusion time of the last - * attempted Copy Blob operation where this blob was the destination blob. - * This value can specify the time of a completed, aborted, or failed copy - * attempt. This header does not appear if a copy is pending, if this blob - * has never been the destination in a Copy Blob operation, or if this blob - * has been modified after a concluded Copy Blob operation using Set Blob - * Properties, Put Blob, or Put Block List. - * - * @param copyCompletionTime the copyCompletionTime value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders copyCompletionTime(OffsetDateTime copyCompletionTime) { - if (copyCompletionTime == null) { - this.copyCompletionTime = null; - } else { - this.copyCompletionTime = new DateTimeRfc1123(copyCompletionTime); - } - return this; - } - - /** - * Get the copyStatusDescription property: Only appears when - * x-ms-copy-status is failed or pending. Describes the cause of the last - * fatal or non-fatal copy operation failure. This header does not appear - * if this blob has never been the destination in a Copy Blob operation, or - * if this blob has been modified after a concluded Copy Blob operation - * using Set Blob Properties, Put Blob, or Put Block List. - * - * @return the copyStatusDescription value. - */ - public String copyStatusDescription() { - return this.copyStatusDescription; - } - - /** - * Set the copyStatusDescription property: Only appears when - * x-ms-copy-status is failed or pending. Describes the cause of the last - * fatal or non-fatal copy operation failure. This header does not appear - * if this blob has never been the destination in a Copy Blob operation, or - * if this blob has been modified after a concluded Copy Blob operation - * using Set Blob Properties, Put Blob, or Put Block List. - * - * @param copyStatusDescription the copyStatusDescription value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders copyStatusDescription(String copyStatusDescription) { - this.copyStatusDescription = copyStatusDescription; - return this; - } - - /** - * Get the copyId property: String identifier for this copy operation. Use - * with Get Blob Properties to check the status of this copy operation, or - * pass to Abort Copy Blob to abort a pending copy. - * - * @return the copyId value. - */ - public String copyId() { - return this.copyId; - } - - /** - * Set the copyId property: String identifier for this copy operation. Use - * with Get Blob Properties to check the status of this copy operation, or - * pass to Abort Copy Blob to abort a pending copy. - * - * @param copyId the copyId value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders copyId(String copyId) { - this.copyId = copyId; - return this; - } - - /** - * Get the copyProgress property: Contains the number of bytes copied and - * the total bytes in the source in the last attempted Copy Blob operation - * where this blob was the destination blob. Can show between 0 and - * Content-Length bytes copied. This header does not appear if this blob - * has never been the destination in a Copy Blob operation, or if this blob - * has been modified after a concluded Copy Blob operation using Set Blob - * Properties, Put Blob, or Put Block List. - * - * @return the copyProgress value. - */ - public String copyProgress() { - return this.copyProgress; - } - - /** - * Set the copyProgress property: Contains the number of bytes copied and - * the total bytes in the source in the last attempted Copy Blob operation - * where this blob was the destination blob. Can show between 0 and - * Content-Length bytes copied. This header does not appear if this blob - * has never been the destination in a Copy Blob operation, or if this blob - * has been modified after a concluded Copy Blob operation using Set Blob - * Properties, Put Blob, or Put Block List. - * - * @param copyProgress the copyProgress value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders copyProgress(String copyProgress) { - this.copyProgress = copyProgress; - return this; - } - - /** - * Get the copySource property: URL up to 2 KB in length that specifies the - * source blob or file used in the last attempted Copy Blob operation where - * this blob was the destination blob. This header does not appear if this - * blob has never been the destination in a Copy Blob operation, or if this - * blob has been modified after a concluded Copy Blob operation using Set - * Blob Properties, Put Blob, or Put Block List. - * - * @return the copySource value. - */ - public String copySource() { - return this.copySource; - } - - /** - * Set the copySource property: URL up to 2 KB in length that specifies the - * source blob or file used in the last attempted Copy Blob operation where - * this blob was the destination blob. This header does not appear if this - * blob has never been the destination in a Copy Blob operation, or if this - * blob has been modified after a concluded Copy Blob operation using Set - * Blob Properties, Put Blob, or Put Block List. - * - * @param copySource the copySource value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders copySource(String copySource) { - this.copySource = copySource; - return this; - } - - /** - * Get the copyStatus property: State of the copy operation identified by - * x-ms-copy-id. Possible values include: 'pending', 'success', 'aborted', - * 'failed'. - * - * @return the copyStatus value. - */ - public CopyStatusType copyStatus() { - return this.copyStatus; - } - - /** - * Set the copyStatus property: State of the copy operation identified by - * x-ms-copy-id. Possible values include: 'pending', 'success', 'aborted', - * 'failed'. - * - * @param copyStatus the copyStatus value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders copyStatus(CopyStatusType copyStatus) { - this.copyStatus = copyStatus; - return this; - } - - /** - * Get the isIncrementalCopy property: Included if the blob is incremental - * copy blob. - * - * @return the isIncrementalCopy value. - */ - public Boolean isIncrementalCopy() { - return this.isIncrementalCopy; - } - - /** - * Set the isIncrementalCopy property: Included if the blob is incremental - * copy blob. - * - * @param isIncrementalCopy the isIncrementalCopy value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders isIncrementalCopy(Boolean isIncrementalCopy) { - this.isIncrementalCopy = isIncrementalCopy; - return this; - } - - /** - * Get the destinationSnapshot property: Included if the blob is - * incremental copy blob or incremental copy snapshot, if x-ms-copy-status - * is success. Snapshot time of the last successful incremental copy - * snapshot for this blob. - * - * @return the destinationSnapshot value. - */ - public String destinationSnapshot() { - return this.destinationSnapshot; - } - - /** - * Set the destinationSnapshot property: Included if the blob is - * incremental copy blob or incremental copy snapshot, if x-ms-copy-status - * is success. Snapshot time of the last successful incremental copy - * snapshot for this blob. - * - * @param destinationSnapshot the destinationSnapshot value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders destinationSnapshot(String destinationSnapshot) { - this.destinationSnapshot = destinationSnapshot; - return this; - } - - /** - * Get the leaseDuration property: When a blob is leased, specifies whether - * the lease is of infinite or fixed duration. Possible values include: - * 'infinite', 'fixed'. - * - * @return the leaseDuration value. - */ - public LeaseDurationType leaseDuration() { - return this.leaseDuration; - } - - /** - * Set the leaseDuration property: When a blob is leased, specifies whether - * the lease is of infinite or fixed duration. Possible values include: - * 'infinite', 'fixed'. - * - * @param leaseDuration the leaseDuration value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders leaseDuration(LeaseDurationType leaseDuration) { - this.leaseDuration = leaseDuration; - return this; - } - - /** - * Get the leaseState property: Lease state of the blob. Possible values - * include: 'available', 'leased', 'expired', 'breaking', 'broken'. - * - * @return the leaseState value. - */ - public LeaseStateType leaseState() { - return this.leaseState; - } - - /** - * Set the leaseState property: Lease state of the blob. Possible values - * include: 'available', 'leased', 'expired', 'breaking', 'broken'. - * - * @param leaseState the leaseState value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders leaseState(LeaseStateType leaseState) { - this.leaseState = leaseState; - return this; - } - - /** - * Get the leaseStatus property: The current lease status of the blob. - * Possible values include: 'locked', 'unlocked'. - * - * @return the leaseStatus value. - */ - public LeaseStatusType leaseStatus() { - return this.leaseStatus; - } - - /** - * Set the leaseStatus property: The current lease status of the blob. - * Possible values include: 'locked', 'unlocked'. - * - * @param leaseStatus the leaseStatus value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders leaseStatus(LeaseStatusType leaseStatus) { - this.leaseStatus = leaseStatus; - return this; - } - - /** - * Get the contentLength property: The number of bytes present in the - * response body. - * - * @return the contentLength value. - */ - public Long contentLength() { - return this.contentLength; - } - - /** - * Set the contentLength property: The number of bytes present in the - * response body. - * - * @param contentLength the contentLength value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders contentLength(Long contentLength) { - this.contentLength = contentLength; - return this; - } - - /** - * Get the contentType property: The content type specified for the blob. - * The default content type is 'application/octet-stream'. - * - * @return the contentType value. - */ - public String contentType() { - return this.contentType; - } - - /** - * Set the contentType property: The content type specified for the blob. - * The default content type is 'application/octet-stream'. - * - * @param contentType the contentType value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders contentType(String contentType) { - this.contentType = contentType; - return this; - } - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @return the contentMD5 value. - */ - public byte[] contentMD5() { - return ImplUtils.clone(this.contentMD5); - } - - /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @param contentMD5 the contentMD5 value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders contentMD5(byte[] contentMD5) { - this.contentMD5 = ImplUtils.clone(contentMD5); - return this; - } - - /** - * Get the contentEncoding property: This header returns the value that was - * specified for the Content-Encoding request header. - * - * @return the contentEncoding value. - */ - public String contentEncoding() { - return this.contentEncoding; - } - - /** - * Set the contentEncoding property: This header returns the value that was - * specified for the Content-Encoding request header. - * - * @param contentEncoding the contentEncoding value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders contentEncoding(String contentEncoding) { - this.contentEncoding = contentEncoding; - return this; - } - - /** - * Get the contentDisposition property: This header returns the value that - * was specified for the 'x-ms-blob-content-disposition' header. The - * Content-Disposition response header field conveys additional information - * about how to process the response payload, and also can be used to - * attach additional metadata. For example, if set to attachment, it - * indicates that the user-agent should not display the response, but - * instead show a Save As dialog with a filename other than the blob name - * specified. - * - * @return the contentDisposition value. - */ - public String contentDisposition() { - return this.contentDisposition; - } - - /** - * Set the contentDisposition property: This header returns the value that - * was specified for the 'x-ms-blob-content-disposition' header. The - * Content-Disposition response header field conveys additional information - * about how to process the response payload, and also can be used to - * attach additional metadata. For example, if set to attachment, it - * indicates that the user-agent should not display the response, but - * instead show a Save As dialog with a filename other than the blob name - * specified. - * - * @param contentDisposition the contentDisposition value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders contentDisposition(String contentDisposition) { - this.contentDisposition = contentDisposition; - return this; - } - - /** - * Get the contentLanguage property: This header returns the value that was - * specified for the Content-Language request header. - * - * @return the contentLanguage value. - */ - public String contentLanguage() { - return this.contentLanguage; - } - - /** - * Set the contentLanguage property: This header returns the value that was - * specified for the Content-Language request header. - * - * @param contentLanguage the contentLanguage value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders contentLanguage(String contentLanguage) { - this.contentLanguage = contentLanguage; - return this; - } - - /** - * Get the cacheControl property: This header is returned if it was - * previously specified for the blob. - * - * @return the cacheControl value. - */ - public String cacheControl() { - return this.cacheControl; - } - - /** - * Set the cacheControl property: This header is returned if it was - * previously specified for the blob. - * - * @param cacheControl the cacheControl value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders cacheControl(String cacheControl) { - this.cacheControl = cacheControl; - return this; - } - - /** - * Get the blobSequenceNumber property: The current sequence number for a - * page blob. This header is not returned for block blobs or append blobs. - * - * @return the blobSequenceNumber value. - */ - public Long blobSequenceNumber() { - return this.blobSequenceNumber; - } - - /** - * Set the blobSequenceNumber property: The current sequence number for a - * page blob. This header is not returned for block blobs or append blobs. - * - * @param blobSequenceNumber the blobSequenceNumber value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders blobSequenceNumber(Long blobSequenceNumber) { - this.blobSequenceNumber = blobSequenceNumber; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the acceptRanges property: Indicates that the service supports - * requests for partial blob content. - * - * @return the acceptRanges value. - */ - public String acceptRanges() { - return this.acceptRanges; - } - - /** - * Set the acceptRanges property: Indicates that the service supports - * requests for partial blob content. - * - * @param acceptRanges the acceptRanges value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders acceptRanges(String acceptRanges) { - this.acceptRanges = acceptRanges; - return this; - } - - /** - * Get the blobCommittedBlockCount property: The number of committed blocks - * present in the blob. This header is returned only for append blobs. - * - * @return the blobCommittedBlockCount value. - */ - public Integer blobCommittedBlockCount() { - return this.blobCommittedBlockCount; - } - - /** - * Set the blobCommittedBlockCount property: The number of committed blocks - * present in the blob. This header is returned only for append blobs. - * - * @param blobCommittedBlockCount the blobCommittedBlockCount value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders blobCommittedBlockCount(Integer blobCommittedBlockCount) { - this.blobCommittedBlockCount = blobCommittedBlockCount; - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the blob data and application metadata are completely encrypted - * using the specified algorithm. Otherwise, the value is set to false - * (when the blob is unencrypted, or if only parts of the blob/application - * metadata are encrypted). - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the blob data and application metadata are completely encrypted - * using the specified algorithm. Otherwise, the value is set to false - * (when the blob is unencrypted, or if only parts of the blob/application - * metadata are encrypted). - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the metadata. This header is only returned when the - * metadata was encrypted with a customer-provided key. - * - * @return the encryptionKeySha256 value. - */ - public String encryptionKeySha256() { - return this.encryptionKeySha256; - } - - /** - * Set the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the metadata. This header is only returned when the - * metadata was encrypted with a customer-provided key. - * - * @param encryptionKeySha256 the encryptionKeySha256 value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders encryptionKeySha256(String encryptionKeySha256) { - this.encryptionKeySha256 = encryptionKeySha256; - return this; - } - - /** - * Get the accessTier property: The tier of page blob on a premium storage - * account or tier of block blob on blob storage LRS accounts. For a list - * of allowed premium page blob tiers, see - * https://docs.microsoft.com/en-us/azure/virtual-machines/windows/premium-storage#features. - * For blob storage LRS accounts, valid values are Hot/Cool/Archive. - * - * @return the accessTier value. - */ - public String accessTier() { - return this.accessTier; - } - - /** - * Set the accessTier property: The tier of page blob on a premium storage - * account or tier of block blob on blob storage LRS accounts. For a list - * of allowed premium page blob tiers, see - * https://docs.microsoft.com/en-us/azure/virtual-machines/windows/premium-storage#features. - * For blob storage LRS accounts, valid values are Hot/Cool/Archive. - * - * @param accessTier the accessTier value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders accessTier(String accessTier) { - this.accessTier = accessTier; - return this; - } - - /** - * Get the accessTierInferred property: For page blobs on a premium storage - * account only. If the access tier is not explicitly set on the blob, the - * tier is inferred based on its content length and this header will be - * returned with true value. - * - * @return the accessTierInferred value. - */ - public Boolean accessTierInferred() { - return this.accessTierInferred; - } - - /** - * Set the accessTierInferred property: For page blobs on a premium storage - * account only. If the access tier is not explicitly set on the blob, the - * tier is inferred based on its content length and this header will be - * returned with true value. - * - * @param accessTierInferred the accessTierInferred value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders accessTierInferred(Boolean accessTierInferred) { - this.accessTierInferred = accessTierInferred; - return this; - } - - /** - * Get the archiveStatus property: For blob storage LRS accounts, valid - * values are rehydrate-pending-to-hot/rehydrate-pending-to-cool. If the - * blob is being rehydrated and is not complete then this header is - * returned indicating that rehydrate is pending and also tells the - * destination tier. - * - * @return the archiveStatus value. - */ - public String archiveStatus() { - return this.archiveStatus; - } - - /** - * Set the archiveStatus property: For blob storage LRS accounts, valid - * values are rehydrate-pending-to-hot/rehydrate-pending-to-cool. If the - * blob is being rehydrated and is not complete then this header is - * returned indicating that rehydrate is pending and also tells the - * destination tier. - * - * @param archiveStatus the archiveStatus value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders archiveStatus(String archiveStatus) { - this.archiveStatus = archiveStatus; - return this; - } - - /** - * Get the accessTierChangeTime property: The time the tier was changed on - * the object. This is only returned if the tier on the block blob was ever - * set. - * - * @return the accessTierChangeTime value. - */ - public OffsetDateTime accessTierChangeTime() { - if (this.accessTierChangeTime == null) { - return null; - } - return this.accessTierChangeTime.dateTime(); - } - - /** - * Set the accessTierChangeTime property: The time the tier was changed on - * the object. This is only returned if the tier on the block blob was ever - * set. - * - * @param accessTierChangeTime the accessTierChangeTime value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders accessTierChangeTime(OffsetDateTime accessTierChangeTime) { - if (accessTierChangeTime == null) { - this.accessTierChangeTime = null; - } else { - this.accessTierChangeTime = new DateTimeRfc1123(accessTierChangeTime); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlobGetPropertiesHeaders object itself. - */ - public BlobGetPropertiesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobHTTPHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobHTTPHeaders.java deleted file mode 100644 index aafbd1eb56e5e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobHTTPHeaders.java +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.util.ImplUtils; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Additional parameters for a set of operations. - */ -@JacksonXmlRootElement(localName = "blob-HTTP-headers") -public final class BlobHTTPHeaders { - /* - * Optional. Sets the blob's cache control. If specified, this property is - * stored with the blob and returned with a read request. - */ - @JsonProperty(value = "blobCacheControl") - private String blobCacheControl; - - /* - * Optional. Sets the blob's content type. If specified, this property is - * stored with the blob and returned with a read request. - */ - @JsonProperty(value = "blobContentType") - private String blobContentType; - - /* - * Optional. An MD5 hash of the blob content. Note that this hash is not - * validated, as the hashes for the individual blocks were validated when - * each was uploaded. - */ - @JsonProperty(value = "blobContentMD5") - private byte[] blobContentMD5; - - /* - * Optional. Sets the blob's content encoding. If specified, this property - * is stored with the blob and returned with a read request. - */ - @JsonProperty(value = "blobContentEncoding") - private String blobContentEncoding; - - /* - * Optional. Set the blob's content language. If specified, this property - * is stored with the blob and returned with a read request. - */ - @JsonProperty(value = "blobContentLanguage") - private String blobContentLanguage; - - /* - * Optional. Sets the blob's Content-Disposition header. - */ - @JsonProperty(value = "blobContentDisposition") - private String blobContentDisposition; - - /** - * Get the blobCacheControl property: Optional. Sets the blob's cache - * control. If specified, this property is stored with the blob and - * returned with a read request. - * - * @return the blobCacheControl value. - */ - public String blobCacheControl() { - return this.blobCacheControl; - } - - /** - * Set the blobCacheControl property: Optional. Sets the blob's cache - * control. If specified, this property is stored with the blob and - * returned with a read request. - * - * @param blobCacheControl the blobCacheControl value to set. - * @return the BlobHTTPHeaders object itself. - */ - public BlobHTTPHeaders blobCacheControl(String blobCacheControl) { - this.blobCacheControl = blobCacheControl; - return this; - } - - /** - * Get the blobContentType property: Optional. Sets the blob's content - * type. If specified, this property is stored with the blob and returned - * with a read request. - * - * @return the blobContentType value. - */ - public String blobContentType() { - return this.blobContentType; - } - - /** - * Set the blobContentType property: Optional. Sets the blob's content - * type. If specified, this property is stored with the blob and returned - * with a read request. - * - * @param blobContentType the blobContentType value to set. - * @return the BlobHTTPHeaders object itself. - */ - public BlobHTTPHeaders blobContentType(String blobContentType) { - this.blobContentType = blobContentType; - return this; - } - - /** - * Get the blobContentMD5 property: Optional. An MD5 hash of the blob - * content. Note that this hash is not validated, as the hashes for the - * individual blocks were validated when each was uploaded. - * - * @return the blobContentMD5 value. - */ - public byte[] blobContentMD5() { - return ImplUtils.clone(this.blobContentMD5); - } - - /** - * Set the blobContentMD5 property: Optional. An MD5 hash of the blob - * content. Note that this hash is not validated, as the hashes for the - * individual blocks were validated when each was uploaded. - * - * @param blobContentMD5 the blobContentMD5 value to set. - * @return the BlobHTTPHeaders object itself. - */ - public BlobHTTPHeaders blobContentMD5(byte[] blobContentMD5) { - this.blobContentMD5 = ImplUtils.clone(blobContentMD5); - return this; - } - - /** - * Get the blobContentEncoding property: Optional. Sets the blob's content - * encoding. If specified, this property is stored with the blob and - * returned with a read request. - * - * @return the blobContentEncoding value. - */ - public String blobContentEncoding() { - return this.blobContentEncoding; - } - - /** - * Set the blobContentEncoding property: Optional. Sets the blob's content - * encoding. If specified, this property is stored with the blob and - * returned with a read request. - * - * @param blobContentEncoding the blobContentEncoding value to set. - * @return the BlobHTTPHeaders object itself. - */ - public BlobHTTPHeaders blobContentEncoding(String blobContentEncoding) { - this.blobContentEncoding = blobContentEncoding; - return this; - } - - /** - * Get the blobContentLanguage property: Optional. Set the blob's content - * language. If specified, this property is stored with the blob and - * returned with a read request. - * - * @return the blobContentLanguage value. - */ - public String blobContentLanguage() { - return this.blobContentLanguage; - } - - /** - * Set the blobContentLanguage property: Optional. Set the blob's content - * language. If specified, this property is stored with the blob and - * returned with a read request. - * - * @param blobContentLanguage the blobContentLanguage value to set. - * @return the BlobHTTPHeaders object itself. - */ - public BlobHTTPHeaders blobContentLanguage(String blobContentLanguage) { - this.blobContentLanguage = blobContentLanguage; - return this; - } - - /** - * Get the blobContentDisposition property: Optional. Sets the blob's - * Content-Disposition header. - * - * @return the blobContentDisposition value. - */ - public String blobContentDisposition() { - return this.blobContentDisposition; - } - - /** - * Set the blobContentDisposition property: Optional. Sets the blob's - * Content-Disposition header. - * - * @param blobContentDisposition the blobContentDisposition value to set. - * @return the BlobHTTPHeaders object itself. - */ - public BlobHTTPHeaders blobContentDisposition(String blobContentDisposition) { - this.blobContentDisposition = blobContentDisposition; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java deleted file mode 100644 index a753352d84240..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobHierarchyListSegment.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.ArrayList; -import java.util.List; - -/** - * The BlobHierarchyListSegment model. - */ -@JacksonXmlRootElement(localName = "Blobs") -public final class BlobHierarchyListSegment { - /* - * The blobPrefixes property. - */ - @JsonProperty("BlobPrefix") - private List blobPrefixes = new ArrayList<>(); - - /* - * The blobItems property. - */ - @JsonProperty("Blob") - private List blobItems = new ArrayList<>(); - - /** - * Get the blobPrefixes property: The blobPrefixes property. - * - * @return the blobPrefixes value. - */ - public List blobPrefixes() { - return this.blobPrefixes; - } - - /** - * Set the blobPrefixes property: The blobPrefixes property. - * - * @param blobPrefixes the blobPrefixes value to set. - * @return the BlobHierarchyListSegment object itself. - */ - public BlobHierarchyListSegment blobPrefixes(List blobPrefixes) { - this.blobPrefixes = blobPrefixes; - return this; - } - - /** - * Get the blobItems property: The blobItems property. - * - * @return the blobItems value. - */ - public List blobItems() { - return this.blobItems; - } - - /** - * Set the blobItems property: The blobItems property. - * - * @param blobItems the blobItems value to set. - * @return the BlobHierarchyListSegment object itself. - */ - public BlobHierarchyListSegment blobItems(List blobItems) { - this.blobItems = blobItems; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobItem.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobItem.java deleted file mode 100644 index 0c69577da7a28..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobItem.java +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * An Azure Storage blob. - */ -@JacksonXmlRootElement(localName = "Blob") -public final class BlobItem { - /* - * The name property. - */ - @JsonProperty(value = "Name", required = true) - private String name; - - /* - * The deleted property. - */ - @JsonProperty(value = "Deleted", required = true) - private boolean deleted; - - /* - * The snapshot property. - */ - @JsonProperty(value = "Snapshot", required = true) - private String snapshot; - - /* - * The versionId property. - */ - @JsonProperty(value = "VersionId", required = true) - private String versionId; - - /* - * The properties property. - */ - @JsonProperty(value = "Properties", required = true) - private BlobProperties properties; - - /* - * The metadata property. - */ - @JsonProperty(value = "Metadata") - private BlobMetadata metadata; - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: The name property. - * - * @param name the name value to set. - * @return the BlobItem object itself. - */ - public BlobItem name(String name) { - this.name = name; - return this; - } - - /** - * Get the deleted property: The deleted property. - * - * @return the deleted value. - */ - public boolean deleted() { - return this.deleted; - } - - /** - * Set the deleted property: The deleted property. - * - * @param deleted the deleted value to set. - * @return the BlobItem object itself. - */ - public BlobItem deleted(boolean deleted) { - this.deleted = deleted; - return this; - } - - /** - * Get the snapshot property: The snapshot property. - * - * @return the snapshot value. - */ - public String snapshot() { - return this.snapshot; - } - - /** - * Set the snapshot property: The snapshot property. - * - * @param snapshot the snapshot value to set. - * @return the BlobItem object itself. - */ - public BlobItem snapshot(String snapshot) { - this.snapshot = snapshot; - return this; - } - - /** - * Get the versionId property: The versionId property. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: The versionId property. - * - * @param versionId the versionId value to set. - * @return the BlobItem object itself. - */ - public BlobItem versionId(String versionId) { - this.versionId = versionId; - return this; - } - - /** - * Get the properties property: The properties property. - * - * @return the properties value. - */ - public BlobProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The properties property. - * - * @param properties the properties value to set. - * @return the BlobItem object itself. - */ - public BlobItem properties(BlobProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the metadata property: The metadata property. - * - * @return the metadata value. - */ - public BlobMetadata metadata() { - return this.metadata; - } - - /** - * Set the metadata property: The metadata property. - * - * @param metadata the metadata value to set. - * @return the BlobItem object itself. - */ - public BlobItem metadata(BlobMetadata metadata) { - this.metadata = metadata; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobMetadata.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobMetadata.java deleted file mode 100644 index 5753ff479dbfb..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobMetadata.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.Map; - -/** - * The BlobMetadata model. - */ -@JacksonXmlRootElement(localName = "Metadata") -public final class BlobMetadata { - /* - * Unmatched properties from the message are deserialized this collection - */ - @JsonProperty(value = "additionalProperties") - private Map additionalProperties; - - /* - * The encrypted property. - */ - @JacksonXmlProperty(localName = "Encrypted", isAttribute = true) - private String encrypted; - - /** - * Get the additionalProperties property: Unmatched properties from the - * message are deserialized this collection. - * - * @return the additionalProperties value. - */ - public Map additionalProperties() { - return this.additionalProperties; - } - - /** - * Set the additionalProperties property: Unmatched properties from the - * message are deserialized this collection. - * - * @param additionalProperties the additionalProperties value to set. - * @return the BlobMetadata object itself. - */ - public BlobMetadata additionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - /** - * Get the encrypted property: The encrypted property. - * - * @return the encrypted value. - */ - public String encrypted() { - return this.encrypted; - } - - /** - * Set the encrypted property: The encrypted property. - * - * @param encrypted the encrypted value to set. - * @return the BlobMetadata object itself. - */ - public BlobMetadata encrypted(String encrypted) { - this.encrypted = encrypted; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobPrefix.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobPrefix.java deleted file mode 100644 index 6507aaecfd380..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobPrefix.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * The BlobPrefix model. - */ -@JacksonXmlRootElement(localName = "BlobPrefix") -public final class BlobPrefix { - /* - * The name property. - */ - @JsonProperty(value = "Name", required = true) - private String name; - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: The name property. - * - * @param name the name value to set. - * @return the BlobPrefix object itself. - */ - public BlobPrefix name(String name) { - this.name = name; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobProperties.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobProperties.java deleted file mode 100644 index a297fe40e0432..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobProperties.java +++ /dev/null @@ -1,884 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.azure.core.implementation.util.ImplUtils; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Properties of a blob. - */ -@JacksonXmlRootElement(localName = "Properties") -public final class BlobProperties { - /* - * The creationTime property. - */ - @JsonProperty(value = "Creation-Time") - private DateTimeRfc1123 creationTime; - - /* - * The lastModified property. - */ - @JsonProperty(value = "Last-Modified", required = true) - private DateTimeRfc1123 lastModified; - - /* - * The etag property. - */ - @JsonProperty(value = "Etag", required = true) - private String etag; - - /* - * Size in bytes - */ - @JsonProperty(value = "Content-Length") - private Long contentLength; - - /* - * The contentType property. - */ - @JsonProperty(value = "Content-Type") - private String contentType; - - /* - * The contentEncoding property. - */ - @JsonProperty(value = "Content-Encoding") - private String contentEncoding; - - /* - * The contentLanguage property. - */ - @JsonProperty(value = "Content-Language") - private String contentLanguage; - - /* - * The contentMD5 property. - */ - @JsonProperty(value = "Content-MD5") - private byte[] contentMD5; - - /* - * The contentDisposition property. - */ - @JsonProperty(value = "Content-Disposition") - private String contentDisposition; - - /* - * The cacheControl property. - */ - @JsonProperty(value = "Cache-Control") - private String cacheControl; - - /* - * The blobSequenceNumber property. - */ - @JsonProperty(value = "x-ms-blob-sequence-number") - private Long blobSequenceNumber; - - /* - * Possible values include: 'BlockBlob', 'PageBlob', 'AppendBlob' - */ - @JsonProperty(value = "BlobType") - private BlobType blobType; - - /* - * Possible values include: 'locked', 'unlocked' - */ - @JsonProperty(value = "LeaseStatus") - private LeaseStatusType leaseStatus; - - /* - * Possible values include: 'available', 'leased', 'expired', 'breaking', - * 'broken' - */ - @JsonProperty(value = "LeaseState") - private LeaseStateType leaseState; - - /* - * Possible values include: 'infinite', 'fixed' - */ - @JsonProperty(value = "LeaseDuration") - private LeaseDurationType leaseDuration; - - /* - * The copyId property. - */ - @JsonProperty(value = "CopyId") - private String copyId; - - /* - * Possible values include: 'pending', 'success', 'aborted', 'failed' - */ - @JsonProperty(value = "CopyStatus") - private CopyStatusType copyStatus; - - /* - * The copySource property. - */ - @JsonProperty(value = "CopySource") - private String copySource; - - /* - * The copyProgress property. - */ - @JsonProperty(value = "CopyProgress") - private String copyProgress; - - /* - * The copyCompletionTime property. - */ - @JsonProperty(value = "CopyCompletionTime") - private DateTimeRfc1123 copyCompletionTime; - - /* - * The copyStatusDescription property. - */ - @JsonProperty(value = "CopyStatusDescription") - private String copyStatusDescription; - - /* - * The serverEncrypted property. - */ - @JsonProperty(value = "ServerEncrypted") - private Boolean serverEncrypted; - - /* - * The incrementalCopy property. - */ - @JsonProperty(value = "IncrementalCopy") - private Boolean incrementalCopy; - - /* - * The destinationSnapshot property. - */ - @JsonProperty(value = "DestinationSnapshot") - private String destinationSnapshot; - - /* - * The deletedTime property. - */ - @JsonProperty(value = "DeletedTime") - private DateTimeRfc1123 deletedTime; - - /* - * The remainingRetentionDays property. - */ - @JsonProperty(value = "RemainingRetentionDays") - private Integer remainingRetentionDays; - - /* - * Possible values include: 'P4', 'P6', 'P10', 'P20', 'P30', 'P40', 'P50', - * 'Hot', 'Cool', 'Archive' - */ - @JsonProperty(value = "AccessTier") - private AccessTier accessTier; - - /* - * The accessTierInferred property. - */ - @JsonProperty(value = "AccessTierInferred") - private Boolean accessTierInferred; - - /* - * Possible values include: 'rehydrate-pending-to-hot', - * 'rehydrate-pending-to-cool' - */ - @JsonProperty(value = "ArchiveStatus") - private ArchiveStatus archiveStatus; - - /* - * The customerProvidedKeySha256 property. - */ - @JsonProperty(value = "CustomerProvidedKeySha256") - private String customerProvidedKeySha256; - - /* - * The accessTierChangeTime property. - */ - @JsonProperty(value = "AccessTierChangeTime") - private DateTimeRfc1123 accessTierChangeTime; - - /** - * Get the creationTime property: The creationTime property. - * - * @return the creationTime value. - */ - public OffsetDateTime creationTime() { - if (this.creationTime == null) { - return null; - } - return this.creationTime.dateTime(); - } - - /** - * Set the creationTime property: The creationTime property. - * - * @param creationTime the creationTime value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties creationTime(OffsetDateTime creationTime) { - if (creationTime == null) { - this.creationTime = null; - } else { - this.creationTime = new DateTimeRfc1123(creationTime); - } - return this; - } - - /** - * Get the lastModified property: The lastModified property. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: The lastModified property. - * - * @param lastModified the lastModified value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the etag property: The etag property. - * - * @return the etag value. - */ - public String etag() { - return this.etag; - } - - /** - * Set the etag property: The etag property. - * - * @param etag the etag value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties etag(String etag) { - this.etag = etag; - return this; - } - - /** - * Get the contentLength property: Size in bytes. - * - * @return the contentLength value. - */ - public Long contentLength() { - return this.contentLength; - } - - /** - * Set the contentLength property: Size in bytes. - * - * @param contentLength the contentLength value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties contentLength(Long contentLength) { - this.contentLength = contentLength; - return this; - } - - /** - * Get the contentType property: The contentType property. - * - * @return the contentType value. - */ - public String contentType() { - return this.contentType; - } - - /** - * Set the contentType property: The contentType property. - * - * @param contentType the contentType value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties contentType(String contentType) { - this.contentType = contentType; - return this; - } - - /** - * Get the contentEncoding property: The contentEncoding property. - * - * @return the contentEncoding value. - */ - public String contentEncoding() { - return this.contentEncoding; - } - - /** - * Set the contentEncoding property: The contentEncoding property. - * - * @param contentEncoding the contentEncoding value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties contentEncoding(String contentEncoding) { - this.contentEncoding = contentEncoding; - return this; - } - - /** - * Get the contentLanguage property: The contentLanguage property. - * - * @return the contentLanguage value. - */ - public String contentLanguage() { - return this.contentLanguage; - } - - /** - * Set the contentLanguage property: The contentLanguage property. - * - * @param contentLanguage the contentLanguage value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties contentLanguage(String contentLanguage) { - this.contentLanguage = contentLanguage; - return this; - } - - /** - * Get the contentMD5 property: The contentMD5 property. - * - * @return the contentMD5 value. - */ - public byte[] contentMD5() { - return ImplUtils.clone(this.contentMD5); - } - - /** - * Set the contentMD5 property: The contentMD5 property. - * - * @param contentMD5 the contentMD5 value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties contentMD5(byte[] contentMD5) { - this.contentMD5 = ImplUtils.clone(contentMD5); - return this; - } - - /** - * Get the contentDisposition property: The contentDisposition property. - * - * @return the contentDisposition value. - */ - public String contentDisposition() { - return this.contentDisposition; - } - - /** - * Set the contentDisposition property: The contentDisposition property. - * - * @param contentDisposition the contentDisposition value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties contentDisposition(String contentDisposition) { - this.contentDisposition = contentDisposition; - return this; - } - - /** - * Get the cacheControl property: The cacheControl property. - * - * @return the cacheControl value. - */ - public String cacheControl() { - return this.cacheControl; - } - - /** - * Set the cacheControl property: The cacheControl property. - * - * @param cacheControl the cacheControl value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties cacheControl(String cacheControl) { - this.cacheControl = cacheControl; - return this; - } - - /** - * Get the blobSequenceNumber property: The blobSequenceNumber property. - * - * @return the blobSequenceNumber value. - */ - public Long blobSequenceNumber() { - return this.blobSequenceNumber; - } - - /** - * Set the blobSequenceNumber property: The blobSequenceNumber property. - * - * @param blobSequenceNumber the blobSequenceNumber value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties blobSequenceNumber(Long blobSequenceNumber) { - this.blobSequenceNumber = blobSequenceNumber; - return this; - } - - /** - * Get the blobType property: Possible values include: 'BlockBlob', - * 'PageBlob', 'AppendBlob'. - * - * @return the blobType value. - */ - public BlobType blobType() { - return this.blobType; - } - - /** - * Set the blobType property: Possible values include: 'BlockBlob', - * 'PageBlob', 'AppendBlob'. - * - * @param blobType the blobType value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties blobType(BlobType blobType) { - this.blobType = blobType; - return this; - } - - /** - * Get the leaseStatus property: Possible values include: 'locked', - * 'unlocked'. - * - * @return the leaseStatus value. - */ - public LeaseStatusType leaseStatus() { - return this.leaseStatus; - } - - /** - * Set the leaseStatus property: Possible values include: 'locked', - * 'unlocked'. - * - * @param leaseStatus the leaseStatus value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties leaseStatus(LeaseStatusType leaseStatus) { - this.leaseStatus = leaseStatus; - return this; - } - - /** - * Get the leaseState property: Possible values include: 'available', - * 'leased', 'expired', 'breaking', 'broken'. - * - * @return the leaseState value. - */ - public LeaseStateType leaseState() { - return this.leaseState; - } - - /** - * Set the leaseState property: Possible values include: 'available', - * 'leased', 'expired', 'breaking', 'broken'. - * - * @param leaseState the leaseState value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties leaseState(LeaseStateType leaseState) { - this.leaseState = leaseState; - return this; - } - - /** - * Get the leaseDuration property: Possible values include: 'infinite', - * 'fixed'. - * - * @return the leaseDuration value. - */ - public LeaseDurationType leaseDuration() { - return this.leaseDuration; - } - - /** - * Set the leaseDuration property: Possible values include: 'infinite', - * 'fixed'. - * - * @param leaseDuration the leaseDuration value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties leaseDuration(LeaseDurationType leaseDuration) { - this.leaseDuration = leaseDuration; - return this; - } - - /** - * Get the copyId property: The copyId property. - * - * @return the copyId value. - */ - public String copyId() { - return this.copyId; - } - - /** - * Set the copyId property: The copyId property. - * - * @param copyId the copyId value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties copyId(String copyId) { - this.copyId = copyId; - return this; - } - - /** - * Get the copyStatus property: Possible values include: 'pending', - * 'success', 'aborted', 'failed'. - * - * @return the copyStatus value. - */ - public CopyStatusType copyStatus() { - return this.copyStatus; - } - - /** - * Set the copyStatus property: Possible values include: 'pending', - * 'success', 'aborted', 'failed'. - * - * @param copyStatus the copyStatus value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties copyStatus(CopyStatusType copyStatus) { - this.copyStatus = copyStatus; - return this; - } - - /** - * Get the copySource property: The copySource property. - * - * @return the copySource value. - */ - public String copySource() { - return this.copySource; - } - - /** - * Set the copySource property: The copySource property. - * - * @param copySource the copySource value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties copySource(String copySource) { - this.copySource = copySource; - return this; - } - - /** - * Get the copyProgress property: The copyProgress property. - * - * @return the copyProgress value. - */ - public String copyProgress() { - return this.copyProgress; - } - - /** - * Set the copyProgress property: The copyProgress property. - * - * @param copyProgress the copyProgress value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties copyProgress(String copyProgress) { - this.copyProgress = copyProgress; - return this; - } - - /** - * Get the copyCompletionTime property: The copyCompletionTime property. - * - * @return the copyCompletionTime value. - */ - public OffsetDateTime copyCompletionTime() { - if (this.copyCompletionTime == null) { - return null; - } - return this.copyCompletionTime.dateTime(); - } - - /** - * Set the copyCompletionTime property: The copyCompletionTime property. - * - * @param copyCompletionTime the copyCompletionTime value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties copyCompletionTime(OffsetDateTime copyCompletionTime) { - if (copyCompletionTime == null) { - this.copyCompletionTime = null; - } else { - this.copyCompletionTime = new DateTimeRfc1123(copyCompletionTime); - } - return this; - } - - /** - * Get the copyStatusDescription property: The copyStatusDescription - * property. - * - * @return the copyStatusDescription value. - */ - public String copyStatusDescription() { - return this.copyStatusDescription; - } - - /** - * Set the copyStatusDescription property: The copyStatusDescription - * property. - * - * @param copyStatusDescription the copyStatusDescription value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties copyStatusDescription(String copyStatusDescription) { - this.copyStatusDescription = copyStatusDescription; - return this; - } - - /** - * Get the serverEncrypted property: The serverEncrypted property. - * - * @return the serverEncrypted value. - */ - public Boolean serverEncrypted() { - return this.serverEncrypted; - } - - /** - * Set the serverEncrypted property: The serverEncrypted property. - * - * @param serverEncrypted the serverEncrypted value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties serverEncrypted(Boolean serverEncrypted) { - this.serverEncrypted = serverEncrypted; - return this; - } - - /** - * Get the incrementalCopy property: The incrementalCopy property. - * - * @return the incrementalCopy value. - */ - public Boolean incrementalCopy() { - return this.incrementalCopy; - } - - /** - * Set the incrementalCopy property: The incrementalCopy property. - * - * @param incrementalCopy the incrementalCopy value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties incrementalCopy(Boolean incrementalCopy) { - this.incrementalCopy = incrementalCopy; - return this; - } - - /** - * Get the destinationSnapshot property: The destinationSnapshot property. - * - * @return the destinationSnapshot value. - */ - public String destinationSnapshot() { - return this.destinationSnapshot; - } - - /** - * Set the destinationSnapshot property: The destinationSnapshot property. - * - * @param destinationSnapshot the destinationSnapshot value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties destinationSnapshot(String destinationSnapshot) { - this.destinationSnapshot = destinationSnapshot; - return this; - } - - /** - * Get the deletedTime property: The deletedTime property. - * - * @return the deletedTime value. - */ - public OffsetDateTime deletedTime() { - if (this.deletedTime == null) { - return null; - } - return this.deletedTime.dateTime(); - } - - /** - * Set the deletedTime property: The deletedTime property. - * - * @param deletedTime the deletedTime value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties deletedTime(OffsetDateTime deletedTime) { - if (deletedTime == null) { - this.deletedTime = null; - } else { - this.deletedTime = new DateTimeRfc1123(deletedTime); - } - return this; - } - - /** - * Get the remainingRetentionDays property: The remainingRetentionDays - * property. - * - * @return the remainingRetentionDays value. - */ - public Integer remainingRetentionDays() { - return this.remainingRetentionDays; - } - - /** - * Set the remainingRetentionDays property: The remainingRetentionDays - * property. - * - * @param remainingRetentionDays the remainingRetentionDays value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties remainingRetentionDays(Integer remainingRetentionDays) { - this.remainingRetentionDays = remainingRetentionDays; - return this; - } - - /** - * Get the accessTier property: Possible values include: 'P4', 'P6', 'P10', - * 'P20', 'P30', 'P40', 'P50', 'Hot', 'Cool', 'Archive'. - * - * @return the accessTier value. - */ - public AccessTier accessTier() { - return this.accessTier; - } - - /** - * Set the accessTier property: Possible values include: 'P4', 'P6', 'P10', - * 'P20', 'P30', 'P40', 'P50', 'Hot', 'Cool', 'Archive'. - * - * @param accessTier the accessTier value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties accessTier(AccessTier accessTier) { - this.accessTier = accessTier; - return this; - } - - /** - * Get the accessTierInferred property: The accessTierInferred property. - * - * @return the accessTierInferred value. - */ - public Boolean accessTierInferred() { - return this.accessTierInferred; - } - - /** - * Set the accessTierInferred property: The accessTierInferred property. - * - * @param accessTierInferred the accessTierInferred value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties accessTierInferred(Boolean accessTierInferred) { - this.accessTierInferred = accessTierInferred; - return this; - } - - /** - * Get the archiveStatus property: Possible values include: - * 'rehydrate-pending-to-hot', 'rehydrate-pending-to-cool'. - * - * @return the archiveStatus value. - */ - public ArchiveStatus archiveStatus() { - return this.archiveStatus; - } - - /** - * Set the archiveStatus property: Possible values include: - * 'rehydrate-pending-to-hot', 'rehydrate-pending-to-cool'. - * - * @param archiveStatus the archiveStatus value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties archiveStatus(ArchiveStatus archiveStatus) { - this.archiveStatus = archiveStatus; - return this; - } - - /** - * Get the customerProvidedKeySha256 property: The - * customerProvidedKeySha256 property. - * - * @return the customerProvidedKeySha256 value. - */ - public String customerProvidedKeySha256() { - return this.customerProvidedKeySha256; - } - - /** - * Set the customerProvidedKeySha256 property: The - * customerProvidedKeySha256 property. - * - * @param customerProvidedKeySha256 the customerProvidedKeySha256 value to - * set. - * @return the BlobProperties object itself. - */ - public BlobProperties customerProvidedKeySha256(String customerProvidedKeySha256) { - this.customerProvidedKeySha256 = customerProvidedKeySha256; - return this; - } - - /** - * Get the accessTierChangeTime property: The accessTierChangeTime - * property. - * - * @return the accessTierChangeTime value. - */ - public OffsetDateTime accessTierChangeTime() { - if (this.accessTierChangeTime == null) { - return null; - } - return this.accessTierChangeTime.dateTime(); - } - - /** - * Set the accessTierChangeTime property: The accessTierChangeTime - * property. - * - * @param accessTierChangeTime the accessTierChangeTime value to set. - * @return the BlobProperties object itself. - */ - public BlobProperties accessTierChangeTime(OffsetDateTime accessTierChangeTime) { - if (accessTierChangeTime == null) { - this.accessTierChangeTime = null; - } else { - this.accessTierChangeTime = new DateTimeRfc1123(accessTierChangeTime); - } - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobReleaseLeaseHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobReleaseLeaseHeaders.java deleted file mode 100644 index 661e9a24db979..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobReleaseLeaseHeaders.java +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for ReleaseLease operation. - */ -@JacksonXmlRootElement(localName = "Blob-ReleaseLease-Headers") -public final class BlobReleaseLeaseHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the blob was last modified. Any operation that - * modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the BlobReleaseLeaseHeaders object itself. - */ - public BlobReleaseLeaseHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the blob was - * last modified. Any operation that modifies the blob, including an update - * of the blob's metadata or properties, changes the last-modified time of - * the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the blob was - * last modified. Any operation that modifies the blob, including an update - * of the blob's metadata or properties, changes the last-modified time of - * the blob. - * - * @param lastModified the lastModified value to set. - * @return the BlobReleaseLeaseHeaders object itself. - */ - public BlobReleaseLeaseHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlobReleaseLeaseHeaders object itself. - */ - public BlobReleaseLeaseHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlobReleaseLeaseHeaders object itself. - */ - public BlobReleaseLeaseHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlobReleaseLeaseHeaders object itself. - */ - public BlobReleaseLeaseHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlobReleaseLeaseHeaders object itself. - */ - public BlobReleaseLeaseHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobRenewLeaseHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobRenewLeaseHeaders.java deleted file mode 100644 index 2ee66b3adb36b..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobRenewLeaseHeaders.java +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for RenewLease operation. - */ -@JacksonXmlRootElement(localName = "Blob-RenewLease-Headers") -public final class BlobRenewLeaseHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the blob was last modified. Any operation that - * modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * Uniquely identifies a blobs's lease - */ - @JsonProperty(value = "x-ms-lease-id") - private String leaseId; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the BlobRenewLeaseHeaders object itself. - */ - public BlobRenewLeaseHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the blob was - * last modified. Any operation that modifies the blob, including an update - * of the blob's metadata or properties, changes the last-modified time of - * the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the blob was - * last modified. Any operation that modifies the blob, including an update - * of the blob's metadata or properties, changes the last-modified time of - * the blob. - * - * @param lastModified the lastModified value to set. - * @return the BlobRenewLeaseHeaders object itself. - */ - public BlobRenewLeaseHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the leaseId property: Uniquely identifies a blobs's lease. - * - * @return the leaseId value. - */ - public String leaseId() { - return this.leaseId; - } - - /** - * Set the leaseId property: Uniquely identifies a blobs's lease. - * - * @param leaseId the leaseId value to set. - * @return the BlobRenewLeaseHeaders object itself. - */ - public BlobRenewLeaseHeaders leaseId(String leaseId) { - this.leaseId = leaseId; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlobRenewLeaseHeaders object itself. - */ - public BlobRenewLeaseHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlobRenewLeaseHeaders object itself. - */ - public BlobRenewLeaseHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlobRenewLeaseHeaders object itself. - */ - public BlobRenewLeaseHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlobRenewLeaseHeaders object itself. - */ - public BlobRenewLeaseHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java deleted file mode 100644 index 09111d5ae3e17..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobSetHTTPHeadersHeaders.java +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for SetHTTPHeaders operation. - */ -@JacksonXmlRootElement(localName = "Blob-SetHTTPHeaders-Headers") -public final class BlobSetHTTPHeadersHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * The current sequence number for a page blob. This header is not returned - * for block blobs or append blobs - */ - @JsonProperty(value = "x-ms-blob-sequence-number") - private Long blobSequenceNumber; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the BlobSetHTTPHeadersHeaders object itself. - */ - public BlobSetHTTPHeadersHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the BlobSetHTTPHeadersHeaders object itself. - */ - public BlobSetHTTPHeadersHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the blobSequenceNumber property: The current sequence number for a - * page blob. This header is not returned for block blobs or append blobs. - * - * @return the blobSequenceNumber value. - */ - public Long blobSequenceNumber() { - return this.blobSequenceNumber; - } - - /** - * Set the blobSequenceNumber property: The current sequence number for a - * page blob. This header is not returned for block blobs or append blobs. - * - * @param blobSequenceNumber the blobSequenceNumber value to set. - * @return the BlobSetHTTPHeadersHeaders object itself. - */ - public BlobSetHTTPHeadersHeaders blobSequenceNumber(Long blobSequenceNumber) { - this.blobSequenceNumber = blobSequenceNumber; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlobSetHTTPHeadersHeaders object itself. - */ - public BlobSetHTTPHeadersHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlobSetHTTPHeadersHeaders object itself. - */ - public BlobSetHTTPHeadersHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlobSetHTTPHeadersHeaders object itself. - */ - public BlobSetHTTPHeadersHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlobSetHTTPHeadersHeaders object itself. - */ - public BlobSetHTTPHeadersHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobSetMetadataHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobSetMetadataHeaders.java deleted file mode 100644 index b831d8446cd1a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobSetMetadataHeaders.java +++ /dev/null @@ -1,276 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for SetMetadata operation. - */ -@JacksonXmlRootElement(localName = "Blob-SetMetadata-Headers") -public final class BlobSetMetadataHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The value of this header is set to true if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. - */ - @JsonProperty(value = "x-ms-request-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The SHA-256 hash of the encryption key used to encrypt the metadata. - * This header is only returned when the metadata was encrypted with a - * customer-provided key. - */ - @JsonProperty(value = "x-ms-encryption-key-sha256") - private String encryptionKeySha256; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the BlobSetMetadataHeaders object itself. - */ - public BlobSetMetadataHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the BlobSetMetadataHeaders object itself. - */ - public BlobSetMetadataHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlobSetMetadataHeaders object itself. - */ - public BlobSetMetadataHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlobSetMetadataHeaders object itself. - */ - public BlobSetMetadataHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlobSetMetadataHeaders object itself. - */ - public BlobSetMetadataHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the BlobSetMetadataHeaders object itself. - */ - public BlobSetMetadataHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the metadata. This header is only returned when the - * metadata was encrypted with a customer-provided key. - * - * @return the encryptionKeySha256 value. - */ - public String encryptionKeySha256() { - return this.encryptionKeySha256; - } - - /** - * Set the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the metadata. This header is only returned when the - * metadata was encrypted with a customer-provided key. - * - * @param encryptionKeySha256 the encryptionKeySha256 value to set. - * @return the BlobSetMetadataHeaders object itself. - */ - public BlobSetMetadataHeaders encryptionKeySha256(String encryptionKeySha256) { - this.encryptionKeySha256 = encryptionKeySha256; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlobSetMetadataHeaders object itself. - */ - public BlobSetMetadataHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobSetTierHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobSetTierHeaders.java deleted file mode 100644 index d2dd04c235a76..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobSetTierHeaders.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Defines headers for SetTier operation. - */ -@JacksonXmlRootElement(localName = "Blob-SetTier-Headers") -public final class BlobSetTierHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * newer. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlobSetTierHeaders object itself. - */ - public BlobSetTierHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and newer. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and newer. - * - * @param version the version value to set. - * @return the BlobSetTierHeaders object itself. - */ - public BlobSetTierHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlobSetTierHeaders object itself. - */ - public BlobSetTierHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java deleted file mode 100644 index c0059d598cceb..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobStartCopyFromURLHeaders.java +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for StartCopyFromURL operation. - */ -@JacksonXmlRootElement(localName = "Blob-StartCopyFromURL-Headers") -public final class BlobStartCopyFromURLHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that identifies the version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * String identifier for this copy operation. Use with Get Blob Properties - * to check the status of this copy operation, or pass to Abort Copy Blob - * to abort a pending copy. - */ - @JsonProperty(value = "x-ms-copy-id") - private String copyId; - - /* - * State of the copy operation identified by x-ms-copy-id. Possible values - * include: 'pending', 'success', 'aborted', 'failed' - */ - @JsonProperty(value = "x-ms-copy-status") - private CopyStatusType copyStatus; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the BlobStartCopyFromURLHeaders object itself. - */ - public BlobStartCopyFromURLHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the BlobStartCopyFromURLHeaders object itself. - */ - public BlobStartCopyFromURLHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlobStartCopyFromURLHeaders object itself. - */ - public BlobStartCopyFromURLHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlobStartCopyFromURLHeaders object itself. - */ - public BlobStartCopyFromURLHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies the version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the BlobStartCopyFromURLHeaders object itself. - */ - public BlobStartCopyFromURLHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlobStartCopyFromURLHeaders object itself. - */ - public BlobStartCopyFromURLHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the copyId property: String identifier for this copy operation. Use - * with Get Blob Properties to check the status of this copy operation, or - * pass to Abort Copy Blob to abort a pending copy. - * - * @return the copyId value. - */ - public String copyId() { - return this.copyId; - } - - /** - * Set the copyId property: String identifier for this copy operation. Use - * with Get Blob Properties to check the status of this copy operation, or - * pass to Abort Copy Blob to abort a pending copy. - * - * @param copyId the copyId value to set. - * @return the BlobStartCopyFromURLHeaders object itself. - */ - public BlobStartCopyFromURLHeaders copyId(String copyId) { - this.copyId = copyId; - return this; - } - - /** - * Get the copyStatus property: State of the copy operation identified by - * x-ms-copy-id. Possible values include: 'pending', 'success', 'aborted', - * 'failed'. - * - * @return the copyStatus value. - */ - public CopyStatusType copyStatus() { - return this.copyStatus; - } - - /** - * Set the copyStatus property: State of the copy operation identified by - * x-ms-copy-id. Possible values include: 'pending', 'success', 'aborted', - * 'failed'. - * - * @param copyStatus the copyStatus value to set. - * @return the BlobStartCopyFromURLHeaders object itself. - */ - public BlobStartCopyFromURLHeaders copyStatus(CopyStatusType copyStatus) { - this.copyStatus = copyStatus; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlobStartCopyFromURLHeaders object itself. - */ - public BlobStartCopyFromURLHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobType.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobType.java deleted file mode 100644 index 65c3d499b6d50..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobType.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for BlobType. - */ -public enum BlobType { - /** - * Enum value BlockBlob. - */ - BLOCK_BLOB("BlockBlob"), - - /** - * Enum value PageBlob. - */ - PAGE_BLOB("PageBlob"), - - /** - * Enum value AppendBlob. - */ - APPEND_BLOB("AppendBlob"); - - /** - * The actual serialized value for a BlobType instance. - */ - private final String value; - - BlobType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a BlobType instance. - * - * @param value the serialized value to parse. - * @return the parsed BlobType object, or null if unable to parse. - */ - @JsonCreator - public static BlobType fromString(String value) { - BlobType[] items = BlobType.values(); - for (BlobType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobUndeleteHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobUndeleteHeaders.java deleted file mode 100644 index 3123885e3af1f..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobUndeleteHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Undelete operation. - */ -@JacksonXmlRootElement(localName = "Blob-Undelete-Headers") -public final class BlobUndeleteHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlobUndeleteHeaders object itself. - */ - public BlobUndeleteHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlobUndeleteHeaders object itself. - */ - public BlobUndeleteHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlobUndeleteHeaders object itself. - */ - public BlobUndeleteHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlobUndeleteHeaders object itself. - */ - public BlobUndeleteHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsAbortCopyFromURLResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobsAbortCopyFromURLResponse.java deleted file mode 100644 index 00f2a2ca97598..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsAbortCopyFromURLResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the abortCopyFromURL operation. - */ -public final class BlobsAbortCopyFromURLResponse extends ResponseBase { - /** - * Creates an instance of BlobsAbortCopyFromURLResponse. - * - * @param request the request which resulted in this BlobsAbortCopyFromURLResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlobsAbortCopyFromURLResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobAbortCopyFromURLHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsAcquireLeaseResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobsAcquireLeaseResponse.java deleted file mode 100644 index 0073deeb63157..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsAcquireLeaseResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the acquireLease operation. - */ -public final class BlobsAcquireLeaseResponse extends ResponseBase { - /** - * Creates an instance of BlobsAcquireLeaseResponse. - * - * @param request the request which resulted in this BlobsAcquireLeaseResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlobsAcquireLeaseResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobAcquireLeaseHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsBreakLeaseResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobsBreakLeaseResponse.java deleted file mode 100644 index 9f5f9fda05ea5..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsBreakLeaseResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the breakLease operation. - */ -public final class BlobsBreakLeaseResponse extends ResponseBase { - /** - * Creates an instance of BlobsBreakLeaseResponse. - * - * @param request the request which resulted in this BlobsBreakLeaseResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlobsBreakLeaseResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobBreakLeaseHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsChangeLeaseResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobsChangeLeaseResponse.java deleted file mode 100644 index eb807aceb583c..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsChangeLeaseResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the changeLease operation. - */ -public final class BlobsChangeLeaseResponse extends ResponseBase { - /** - * Creates an instance of BlobsChangeLeaseResponse. - * - * @param request the request which resulted in this BlobsChangeLeaseResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlobsChangeLeaseResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobChangeLeaseHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsCopyFromURLResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobsCopyFromURLResponse.java deleted file mode 100644 index 36220b0bf1be6..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsCopyFromURLResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the copyFromURL operation. - */ -public final class BlobsCopyFromURLResponse extends ResponseBase { - /** - * Creates an instance of BlobsCopyFromURLResponse. - * - * @param request the request which resulted in this BlobsCopyFromURLResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlobsCopyFromURLResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobCopyFromURLHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsCreateSnapshotResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobsCreateSnapshotResponse.java deleted file mode 100644 index 3a76a46d1b72c..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsCreateSnapshotResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the createSnapshot operation. - */ -public final class BlobsCreateSnapshotResponse extends ResponseBase { - /** - * Creates an instance of BlobsCreateSnapshotResponse. - * - * @param request the request which resulted in this BlobsCreateSnapshotResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlobsCreateSnapshotResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobCreateSnapshotHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsDeleteResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobsDeleteResponse.java deleted file mode 100644 index 0222cdc4676d2..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsDeleteResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the delete operation. - */ -public final class BlobsDeleteResponse extends ResponseBase { - /** - * Creates an instance of BlobsDeleteResponse. - * - * @param request the request which resulted in this BlobsDeleteResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlobsDeleteResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobDeleteHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsDownloadResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobsDownloadResponse.java deleted file mode 100644 index 1101ca18c80ec..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsDownloadResponse.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; -import io.netty.buffer.ByteBuf; -import java.io.Closeable; -import reactor.core.publisher.Flux; - -/** - * Contains all response data for the download operation. - */ -public final class BlobsDownloadResponse extends ResponseBase> implements Closeable { - /** - * Creates an instance of BlobsDownloadResponse. - * - * @param request the request which resulted in this BlobsDownloadResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the content stream. - * @param headers the deserialized headers of the HTTP response. - */ - public BlobsDownloadResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Flux value, BlobDownloadHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the response content stream. - */ - @Override - public Flux value() { - return super.value(); - } - - /** - * Disposes of the connection associated with this stream response. - */ - @Override - public void close() { - value().subscribe(bb -> { }, t -> { }).dispose(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsGetAccountInfoResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobsGetAccountInfoResponse.java deleted file mode 100644 index 5b33d4b6f4958..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsGetAccountInfoResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getAccountInfo operation. - */ -public final class BlobsGetAccountInfoResponse extends ResponseBase { - /** - * Creates an instance of BlobsGetAccountInfoResponse. - * - * @param request the request which resulted in this BlobsGetAccountInfoResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlobsGetAccountInfoResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobGetAccountInfoHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsGetPropertiesResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobsGetPropertiesResponse.java deleted file mode 100644 index de24a1b0b20ac..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsGetPropertiesResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getProperties operation. - */ -public final class BlobsGetPropertiesResponse extends ResponseBase { - /** - * Creates an instance of BlobsGetPropertiesResponse. - * - * @param request the request which resulted in this BlobsGetPropertiesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlobsGetPropertiesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobGetPropertiesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsReleaseLeaseResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobsReleaseLeaseResponse.java deleted file mode 100644 index f379ead4105b2..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsReleaseLeaseResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the releaseLease operation. - */ -public final class BlobsReleaseLeaseResponse extends ResponseBase { - /** - * Creates an instance of BlobsReleaseLeaseResponse. - * - * @param request the request which resulted in this BlobsReleaseLeaseResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlobsReleaseLeaseResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobReleaseLeaseHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsRenewLeaseResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobsRenewLeaseResponse.java deleted file mode 100644 index 53dfcb83563a8..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsRenewLeaseResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the renewLease operation. - */ -public final class BlobsRenewLeaseResponse extends ResponseBase { - /** - * Creates an instance of BlobsRenewLeaseResponse. - * - * @param request the request which resulted in this BlobsRenewLeaseResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlobsRenewLeaseResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobRenewLeaseHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsSetHTTPHeadersResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobsSetHTTPHeadersResponse.java deleted file mode 100644 index 6e52d09d1b8b2..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsSetHTTPHeadersResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the setHTTPHeaders operation. - */ -public final class BlobsSetHTTPHeadersResponse extends ResponseBase { - /** - * Creates an instance of BlobsSetHTTPHeadersResponse. - * - * @param request the request which resulted in this BlobsSetHTTPHeadersResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlobsSetHTTPHeadersResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobSetHTTPHeadersHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsSetMetadataResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobsSetMetadataResponse.java deleted file mode 100644 index e9979fdcb85b7..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsSetMetadataResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the setMetadata operation. - */ -public final class BlobsSetMetadataResponse extends ResponseBase { - /** - * Creates an instance of BlobsSetMetadataResponse. - * - * @param request the request which resulted in this BlobsSetMetadataResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlobsSetMetadataResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobSetMetadataHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsSetTierResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobsSetTierResponse.java deleted file mode 100644 index d11f828184716..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsSetTierResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the setTier operation. - */ -public final class BlobsSetTierResponse extends ResponseBase { - /** - * Creates an instance of BlobsSetTierResponse. - * - * @param request the request which resulted in this BlobsSetTierResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlobsSetTierResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobSetTierHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsStartCopyFromURLResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobsStartCopyFromURLResponse.java deleted file mode 100644 index 6c7821de05f35..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsStartCopyFromURLResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the startCopyFromURL operation. - */ -public final class BlobsStartCopyFromURLResponse extends ResponseBase { - /** - * Creates an instance of BlobsStartCopyFromURLResponse. - * - * @param request the request which resulted in this BlobsStartCopyFromURLResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlobsStartCopyFromURLResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobStartCopyFromURLHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsUndeleteResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlobsUndeleteResponse.java deleted file mode 100644 index 21cf7a0cbe9f8..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlobsUndeleteResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the undelete operation. - */ -public final class BlobsUndeleteResponse extends ResponseBase { - /** - * Creates an instance of BlobsUndeleteResponse. - * - * @param request the request which resulted in this BlobsUndeleteResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlobsUndeleteResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlobUndeleteHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/Block.java b/storage/client/src/main/java/com/azure/storage/blob/models/Block.java deleted file mode 100644 index 8fbfcaa8a7abe..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/Block.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Represents a single block in a block blob. It describes the block's ID and - * size. - */ -@JacksonXmlRootElement(localName = "Block") -public final class Block { - /* - * The base64 encoded block ID. - */ - @JsonProperty(value = "Name", required = true) - private String name; - - /* - * The block size in bytes. - */ - @JsonProperty(value = "Size", required = true) - private int size; - - /** - * Get the name property: The base64 encoded block ID. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: The base64 encoded block ID. - * - * @param name the name value to set. - * @return the Block object itself. - */ - public Block name(String name) { - this.name = name; - return this; - } - - /** - * Get the size property: The block size in bytes. - * - * @return the size value. - */ - public int size() { - return this.size; - } - - /** - * Set the size property: The block size in bytes. - * - * @param size the size value to set. - * @return the Block object itself. - */ - public Block size(int size) { - this.size = size; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java deleted file mode 100644 index a2605e19cf430..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobCommitBlockListHeaders.java +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.azure.core.implementation.util.ImplUtils; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for CommitBlockList operation. - */ -@JacksonXmlRootElement(localName = "BlockBlob-CommitBlockList-Headers") -public final class BlockBlobCommitBlockListHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. - */ - @JsonProperty(value = "Content-MD5") - private byte[] contentMD5; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that identifies a version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The value of this header is set to true if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. - */ - @JsonProperty(value = "x-ms-request-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The SHA-256 hash of the encryption key used to encrypt the blob. This - * header is only returned when the blob was encrypted with a - * customer-provided key. - */ - @JsonProperty(value = "x-ms-encryption-key-sha256") - private String encryptionKeySha256; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the BlockBlobCommitBlockListHeaders object itself. - */ - public BlockBlobCommitBlockListHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the BlockBlobCommitBlockListHeaders object itself. - */ - public BlockBlobCommitBlockListHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @return the contentMD5 value. - */ - public byte[] contentMD5() { - return ImplUtils.clone(this.contentMD5); - } - - /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @param contentMD5 the contentMD5 value to set. - * @return the BlockBlobCommitBlockListHeaders object itself. - */ - public BlockBlobCommitBlockListHeaders contentMD5(byte[] contentMD5) { - this.contentMD5 = ImplUtils.clone(contentMD5); - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlockBlobCommitBlockListHeaders object itself. - */ - public BlockBlobCommitBlockListHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlockBlobCommitBlockListHeaders object itself. - */ - public BlockBlobCommitBlockListHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the BlockBlobCommitBlockListHeaders object itself. - */ - public BlockBlobCommitBlockListHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlockBlobCommitBlockListHeaders object itself. - */ - public BlockBlobCommitBlockListHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the BlockBlobCommitBlockListHeaders object itself. - */ - public BlockBlobCommitBlockListHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the blob. This header is only returned when the blob - * was encrypted with a customer-provided key. - * - * @return the encryptionKeySha256 value. - */ - public String encryptionKeySha256() { - return this.encryptionKeySha256; - } - - /** - * Set the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the blob. This header is only returned when the blob - * was encrypted with a customer-provided key. - * - * @param encryptionKeySha256 the encryptionKeySha256 value to set. - * @return the BlockBlobCommitBlockListHeaders object itself. - */ - public BlockBlobCommitBlockListHeaders encryptionKeySha256(String encryptionKeySha256) { - this.encryptionKeySha256 = encryptionKeySha256; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlockBlobCommitBlockListHeaders object itself. - */ - public BlockBlobCommitBlockListHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java deleted file mode 100644 index 26d77f85abadf..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobGetBlockListHeaders.java +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for GetBlockList operation. - */ -@JacksonXmlRootElement(localName = "BlockBlob-GetBlockList-Headers") -public final class BlockBlobGetBlockListHeaders { - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * The media type of the body of the response. For Get Block List this is - * 'application/xml' - */ - @JsonProperty(value = "Content-Type") - private String contentType; - - /* - * The size of the blob in bytes. - */ - @JsonProperty(value = "x-ms-blob-content-length") - private Long blobContentLength; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the BlockBlobGetBlockListHeaders object itself. - */ - public BlockBlobGetBlockListHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the BlockBlobGetBlockListHeaders object itself. - */ - public BlockBlobGetBlockListHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the contentType property: The media type of the body of the - * response. For Get Block List this is 'application/xml'. - * - * @return the contentType value. - */ - public String contentType() { - return this.contentType; - } - - /** - * Set the contentType property: The media type of the body of the - * response. For Get Block List this is 'application/xml'. - * - * @param contentType the contentType value to set. - * @return the BlockBlobGetBlockListHeaders object itself. - */ - public BlockBlobGetBlockListHeaders contentType(String contentType) { - this.contentType = contentType; - return this; - } - - /** - * Get the blobContentLength property: The size of the blob in bytes. - * - * @return the blobContentLength value. - */ - public Long blobContentLength() { - return this.blobContentLength; - } - - /** - * Set the blobContentLength property: The size of the blob in bytes. - * - * @param blobContentLength the blobContentLength value to set. - * @return the BlockBlobGetBlockListHeaders object itself. - */ - public BlockBlobGetBlockListHeaders blobContentLength(Long blobContentLength) { - this.blobContentLength = blobContentLength; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlockBlobGetBlockListHeaders object itself. - */ - public BlockBlobGetBlockListHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlockBlobGetBlockListHeaders object itself. - */ - public BlockBlobGetBlockListHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlockBlobGetBlockListHeaders object itself. - */ - public BlockBlobGetBlockListHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlockBlobGetBlockListHeaders object itself. - */ - public BlockBlobGetBlockListHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java deleted file mode 100644 index 1b434c919342f..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockFromURLHeaders.java +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.azure.core.implementation.util.ImplUtils; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for StageBlockFromURL operation. - */ -@JacksonXmlRootElement(localName = "BlockBlob-StageBlockFromURL-Headers") -public final class BlockBlobStageBlockFromURLHeaders { - /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. - */ - @JsonProperty(value = "Content-MD5") - private byte[] contentMD5; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The value of this header is set to true if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. - */ - @JsonProperty(value = "x-ms-request-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The SHA-256 hash of the encryption key used to encrypt the block. This - * header is only returned when the block was encrypted with a - * customer-provided key. - */ - @JsonProperty(value = "x-ms-encryption-key-sha256") - private String encryptionKeySha256; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @return the contentMD5 value. - */ - public byte[] contentMD5() { - return ImplUtils.clone(this.contentMD5); - } - - /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @param contentMD5 the contentMD5 value to set. - * @return the BlockBlobStageBlockFromURLHeaders object itself. - */ - public BlockBlobStageBlockFromURLHeaders contentMD5(byte[] contentMD5) { - this.contentMD5 = ImplUtils.clone(contentMD5); - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlockBlobStageBlockFromURLHeaders object itself. - */ - public BlockBlobStageBlockFromURLHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlockBlobStageBlockFromURLHeaders object itself. - */ - public BlockBlobStageBlockFromURLHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlockBlobStageBlockFromURLHeaders object itself. - */ - public BlockBlobStageBlockFromURLHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the BlockBlobStageBlockFromURLHeaders object itself. - */ - public BlockBlobStageBlockFromURLHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the block. This header is only returned when the - * block was encrypted with a customer-provided key. - * - * @return the encryptionKeySha256 value. - */ - public String encryptionKeySha256() { - return this.encryptionKeySha256; - } - - /** - * Set the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the block. This header is only returned when the - * block was encrypted with a customer-provided key. - * - * @param encryptionKeySha256 the encryptionKeySha256 value to set. - * @return the BlockBlobStageBlockFromURLHeaders object itself. - */ - public BlockBlobStageBlockFromURLHeaders encryptionKeySha256(String encryptionKeySha256) { - this.encryptionKeySha256 = encryptionKeySha256; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlockBlobStageBlockFromURLHeaders object itself. - */ - public BlockBlobStageBlockFromURLHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockHeaders.java deleted file mode 100644 index 40108ad24ec2a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobStageBlockHeaders.java +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.azure.core.implementation.util.ImplUtils; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for StageBlock operation. - */ -@JacksonXmlRootElement(localName = "BlockBlob-StageBlock-Headers") -public final class BlockBlobStageBlockHeaders { - /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. - */ - @JsonProperty(value = "Content-MD5") - private byte[] contentMD5; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The value of this header is set to true if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. - */ - @JsonProperty(value = "x-ms-request-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The SHA-256 hash of the encryption key used to encrypt the block. This - * header is only returned when the block was encrypted with a - * customer-provided key. - */ - @JsonProperty(value = "x-ms-encryption-key-sha256") - private String encryptionKeySha256; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @return the contentMD5 value. - */ - public byte[] contentMD5() { - return ImplUtils.clone(this.contentMD5); - } - - /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @param contentMD5 the contentMD5 value to set. - * @return the BlockBlobStageBlockHeaders object itself. - */ - public BlockBlobStageBlockHeaders contentMD5(byte[] contentMD5) { - this.contentMD5 = ImplUtils.clone(contentMD5); - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlockBlobStageBlockHeaders object itself. - */ - public BlockBlobStageBlockHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlockBlobStageBlockHeaders object itself. - */ - public BlockBlobStageBlockHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlockBlobStageBlockHeaders object itself. - */ - public BlockBlobStageBlockHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the BlockBlobStageBlockHeaders object itself. - */ - public BlockBlobStageBlockHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the block. This header is only returned when the - * block was encrypted with a customer-provided key. - * - * @return the encryptionKeySha256 value. - */ - public String encryptionKeySha256() { - return this.encryptionKeySha256; - } - - /** - * Set the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the block. This header is only returned when the - * block was encrypted with a customer-provided key. - * - * @param encryptionKeySha256 the encryptionKeySha256 value to set. - * @return the BlockBlobStageBlockHeaders object itself. - */ - public BlockBlobStageBlockHeaders encryptionKeySha256(String encryptionKeySha256) { - this.encryptionKeySha256 = encryptionKeySha256; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlockBlobStageBlockHeaders object itself. - */ - public BlockBlobStageBlockHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobUploadHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobUploadHeaders.java deleted file mode 100644 index e5430e100e6ea..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobUploadHeaders.java +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.azure.core.implementation.util.ImplUtils; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Upload operation. - */ -@JacksonXmlRootElement(localName = "BlockBlob-Upload-Headers") -public final class BlockBlobUploadHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. - */ - @JsonProperty(value = "Content-MD5") - private byte[] contentMD5; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that identifies a version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The value of this header is set to true if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. - */ - @JsonProperty(value = "x-ms-request-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The SHA-256 hash of the encryption key used to encrypt the blob. This - * header is only returned when the blob was encrypted with a - * customer-provided key. - */ - @JsonProperty(value = "x-ms-encryption-key-sha256") - private String encryptionKeySha256; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the BlockBlobUploadHeaders object itself. - */ - public BlockBlobUploadHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the BlockBlobUploadHeaders object itself. - */ - public BlockBlobUploadHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @return the contentMD5 value. - */ - public byte[] contentMD5() { - return ImplUtils.clone(this.contentMD5); - } - - /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @param contentMD5 the contentMD5 value to set. - * @return the BlockBlobUploadHeaders object itself. - */ - public BlockBlobUploadHeaders contentMD5(byte[] contentMD5) { - this.contentMD5 = ImplUtils.clone(contentMD5); - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the BlockBlobUploadHeaders object itself. - */ - public BlockBlobUploadHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the BlockBlobUploadHeaders object itself. - */ - public BlockBlobUploadHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the BlockBlobUploadHeaders object itself. - */ - public BlockBlobUploadHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the BlockBlobUploadHeaders object itself. - */ - public BlockBlobUploadHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the BlockBlobUploadHeaders object itself. - */ - public BlockBlobUploadHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the blob. This header is only returned when the blob - * was encrypted with a customer-provided key. - * - * @return the encryptionKeySha256 value. - */ - public String encryptionKeySha256() { - return this.encryptionKeySha256; - } - - /** - * Set the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the blob. This header is only returned when the blob - * was encrypted with a customer-provided key. - * - * @param encryptionKeySha256 the encryptionKeySha256 value to set. - * @return the BlockBlobUploadHeaders object itself. - */ - public BlockBlobUploadHeaders encryptionKeySha256(String encryptionKeySha256) { - this.encryptionKeySha256 = encryptionKeySha256; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the BlockBlobUploadHeaders object itself. - */ - public BlockBlobUploadHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobsCommitBlockListResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobsCommitBlockListResponse.java deleted file mode 100644 index e68cbc1f07702..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobsCommitBlockListResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the commitBlockList operation. - */ -public final class BlockBlobsCommitBlockListResponse extends ResponseBase { - /** - * Creates an instance of BlockBlobsCommitBlockListResponse. - * - * @param request the request which resulted in this BlockBlobsCommitBlockListResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlockBlobsCommitBlockListResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlockBlobCommitBlockListHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobsGetBlockListResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobsGetBlockListResponse.java deleted file mode 100644 index beddda624e0dc..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobsGetBlockListResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getBlockList operation. - */ -public final class BlockBlobsGetBlockListResponse extends ResponseBase { - /** - * Creates an instance of BlockBlobsGetBlockListResponse. - * - * @param request the request which resulted in this BlockBlobsGetBlockListResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlockBlobsGetBlockListResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, BlockList value, BlockBlobGetBlockListHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public BlockList value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobsStageBlockFromURLResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobsStageBlockFromURLResponse.java deleted file mode 100644 index 848a75fefcb7b..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobsStageBlockFromURLResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the stageBlockFromURL operation. - */ -public final class BlockBlobsStageBlockFromURLResponse extends ResponseBase { - /** - * Creates an instance of BlockBlobsStageBlockFromURLResponse. - * - * @param request the request which resulted in this BlockBlobsStageBlockFromURLResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlockBlobsStageBlockFromURLResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlockBlobStageBlockFromURLHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobsStageBlockResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobsStageBlockResponse.java deleted file mode 100644 index 9a1e5f8a2cbae..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobsStageBlockResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the stageBlock operation. - */ -public final class BlockBlobsStageBlockResponse extends ResponseBase { - /** - * Creates an instance of BlockBlobsStageBlockResponse. - * - * @param request the request which resulted in this BlockBlobsStageBlockResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlockBlobsStageBlockResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlockBlobStageBlockHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobsUploadResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobsUploadResponse.java deleted file mode 100644 index aa667bea4116c..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlockBlobsUploadResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the upload operation. - */ -public final class BlockBlobsUploadResponse extends ResponseBase { - /** - * Creates an instance of BlockBlobsUploadResponse. - * - * @param request the request which resulted in this BlockBlobsUploadResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public BlockBlobsUploadResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, BlockBlobUploadHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlockItem.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlockItem.java deleted file mode 100644 index 4920fd7334a14..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlockItem.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -/** - * Represents a single block in a block blob. - */ -public final class BlockItem { - /* Internal block object. */ - private Block block; - - private boolean isCommitted; - - /** - * Creates an instance of a BlobItem. - * @param block the API blob object - * @param isCommitted if the blob is committed - */ - public BlockItem(Block block, boolean isCommitted) { - this.block = block; - this.isCommitted = isCommitted; - } - - /** - * @return the base64 encoded block ID. - */ - public String name() { - return this.block.name(); - } - - /** - * @return the block size in bytes. - */ - public int size() { - return this.block.size(); - } - - /** - * @return if the block has been committed. - */ - public boolean isCommitted() { - return isCommitted; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlockList.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlockList.java deleted file mode 100644 index 70a0fb8d312ef..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlockList.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.ArrayList; -import java.util.List; - -/** - * The BlockList model. - */ -@JacksonXmlRootElement(localName = "BlockList") -public final class BlockList { - private static final class CommittedBlocksWrapper { - @JacksonXmlProperty(localName = "Block") - private final List items; - - @JsonCreator - private CommittedBlocksWrapper(@JacksonXmlProperty(localName = "Block") List items) { - this.items = items; - } - } - - /* - * The committedBlocks property. - */ - @JsonProperty(value = "CommittedBlocks") - private CommittedBlocksWrapper committedBlocks; - - private static final class UncommittedBlocksWrapper { - @JacksonXmlProperty(localName = "Block") - private final List items; - - @JsonCreator - private UncommittedBlocksWrapper(@JacksonXmlProperty(localName = "Block") List items) { - this.items = items; - } - } - - /* - * The uncommittedBlocks property. - */ - @JsonProperty(value = "UncommittedBlocks") - private UncommittedBlocksWrapper uncommittedBlocks; - - /** - * Get the committedBlocks property: The committedBlocks property. - * - * @return the committedBlocks value. - */ - public List committedBlocks() { - if (this.committedBlocks == null) { - this.committedBlocks = new CommittedBlocksWrapper(new ArrayList()); - } - return this.committedBlocks.items; - } - - /** - * Set the committedBlocks property: The committedBlocks property. - * - * @param committedBlocks the committedBlocks value to set. - * @return the BlockList object itself. - */ - public BlockList committedBlocks(List committedBlocks) { - this.committedBlocks = new CommittedBlocksWrapper(committedBlocks); - return this; - } - - /** - * Get the uncommittedBlocks property: The uncommittedBlocks property. - * - * @return the uncommittedBlocks value. - */ - public List uncommittedBlocks() { - if (this.uncommittedBlocks == null) { - this.uncommittedBlocks = new UncommittedBlocksWrapper(new ArrayList()); - } - return this.uncommittedBlocks.items; - } - - /** - * Set the uncommittedBlocks property: The uncommittedBlocks property. - * - * @param uncommittedBlocks the uncommittedBlocks value to set. - * @return the BlockList object itself. - */ - public BlockList uncommittedBlocks(List uncommittedBlocks) { - this.uncommittedBlocks = new UncommittedBlocksWrapper(uncommittedBlocks); - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlockListType.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlockListType.java deleted file mode 100644 index e02ffbda9026a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlockListType.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for BlockListType. - */ -public enum BlockListType { - /** - * Enum value committed. - */ - COMMITTED("committed"), - - /** - * Enum value uncommitted. - */ - UNCOMMITTED("uncommitted"), - - /** - * Enum value all. - */ - ALL("all"); - - /** - * The actual serialized value for a BlockListType instance. - */ - private final String value; - - BlockListType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a BlockListType instance. - * - * @param value the serialized value to parse. - * @return the parsed BlockListType object, or null if unable to parse. - */ - @JsonCreator - public static BlockListType fromString(String value) { - BlockListType[] items = BlockListType.values(); - for (BlockListType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/BlockLookupList.java b/storage/client/src/main/java/com/azure/storage/blob/models/BlockLookupList.java deleted file mode 100644 index 9cc63338a8996..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/BlockLookupList.java +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.ArrayList; -import java.util.List; - -/** - * The BlockLookupList model. - */ -@JacksonXmlRootElement(localName = "BlockList") -public final class BlockLookupList { - /* - * The committed property. - */ - @JsonProperty("Committed") - private List committed = new ArrayList<>(); - - /* - * The uncommitted property. - */ - @JsonProperty("Uncommitted") - private List uncommitted = new ArrayList<>(); - - /* - * The latest property. - */ - @JsonProperty("Latest") - private List latest = new ArrayList<>(); - - /** - * Get the committed property: The committed property. - * - * @return the committed value. - */ - public List committed() { - return this.committed; - } - - /** - * Set the committed property: The committed property. - * - * @param committed the committed value to set. - * @return the BlockLookupList object itself. - */ - public BlockLookupList committed(List committed) { - this.committed = committed; - return this; - } - - /** - * Get the uncommitted property: The uncommitted property. - * - * @return the uncommitted value. - */ - public List uncommitted() { - return this.uncommitted; - } - - /** - * Set the uncommitted property: The uncommitted property. - * - * @param uncommitted the uncommitted value to set. - * @return the BlockLookupList object itself. - */ - public BlockLookupList uncommitted(List uncommitted) { - this.uncommitted = uncommitted; - return this; - } - - /** - * Get the latest property: The latest property. - * - * @return the latest value. - */ - public List latest() { - return this.latest; - } - - /** - * Set the latest property: The latest property. - * - * @param latest the latest value to set. - * @return the BlockLookupList object itself. - */ - public BlockLookupList latest(List latest) { - this.latest = latest; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ClearRange.java b/storage/client/src/main/java/com/azure/storage/blob/models/ClearRange.java deleted file mode 100644 index cb8d7a208ab3a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ClearRange.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * The ClearRange model. - */ -@JacksonXmlRootElement(localName = "ClearRange") -public final class ClearRange { - /* - * The start property. - */ - @JsonProperty(value = "Start", required = true) - private long start; - - /* - * The end property. - */ - @JsonProperty(value = "End", required = true) - private long end; - - /** - * Get the start property: The start property. - * - * @return the start value. - */ - public long start() { - return this.start; - } - - /** - * Set the start property: The start property. - * - * @param start the start value to set. - * @return the ClearRange object itself. - */ - public ClearRange start(long start) { - this.start = start; - return this; - } - - /** - * Get the end property: The end property. - * - * @return the end value. - */ - public long end() { - return this.end; - } - - /** - * Set the end property: The end property. - * - * @param end the end value to set. - * @return the ClearRange object itself. - */ - public ClearRange end(long end) { - this.end = end; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java deleted file mode 100644 index 0ba172f04e33a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerAcquireLeaseHeaders.java +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for AcquireLease operation. - */ -@JacksonXmlRootElement(localName = "Container-AcquireLease-Headers") -public final class ContainerAcquireLeaseHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * Uniquely identifies a container's lease - */ - @JsonProperty(value = "x-ms-lease-id") - private String leaseId; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the ContainerAcquireLeaseHeaders object itself. - */ - public ContainerAcquireLeaseHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the ContainerAcquireLeaseHeaders object itself. - */ - public ContainerAcquireLeaseHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the leaseId property: Uniquely identifies a container's lease. - * - * @return the leaseId value. - */ - public String leaseId() { - return this.leaseId; - } - - /** - * Set the leaseId property: Uniquely identifies a container's lease. - * - * @param leaseId the leaseId value to set. - * @return the ContainerAcquireLeaseHeaders object itself. - */ - public ContainerAcquireLeaseHeaders leaseId(String leaseId) { - this.leaseId = leaseId; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ContainerAcquireLeaseHeaders object itself. - */ - public ContainerAcquireLeaseHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ContainerAcquireLeaseHeaders object itself. - */ - public ContainerAcquireLeaseHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ContainerAcquireLeaseHeaders object itself. - */ - public ContainerAcquireLeaseHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ContainerAcquireLeaseHeaders object itself. - */ - public ContainerAcquireLeaseHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerBreakLeaseHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainerBreakLeaseHeaders.java deleted file mode 100644 index 98a1106ccc6ef..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerBreakLeaseHeaders.java +++ /dev/null @@ -1,240 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for BreakLease operation. - */ -@JacksonXmlRootElement(localName = "Container-BreakLease-Headers") -public final class ContainerBreakLeaseHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * Approximate time remaining in the lease period, in seconds. - */ - @JsonProperty(value = "x-ms-lease-time") - private Integer leaseTime; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the ContainerBreakLeaseHeaders object itself. - */ - public ContainerBreakLeaseHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the ContainerBreakLeaseHeaders object itself. - */ - public ContainerBreakLeaseHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the leaseTime property: Approximate time remaining in the lease - * period, in seconds. - * - * @return the leaseTime value. - */ - public Integer leaseTime() { - return this.leaseTime; - } - - /** - * Set the leaseTime property: Approximate time remaining in the lease - * period, in seconds. - * - * @param leaseTime the leaseTime value to set. - * @return the ContainerBreakLeaseHeaders object itself. - */ - public ContainerBreakLeaseHeaders leaseTime(Integer leaseTime) { - this.leaseTime = leaseTime; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ContainerBreakLeaseHeaders object itself. - */ - public ContainerBreakLeaseHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ContainerBreakLeaseHeaders object itself. - */ - public ContainerBreakLeaseHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ContainerBreakLeaseHeaders object itself. - */ - public ContainerBreakLeaseHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ContainerBreakLeaseHeaders object itself. - */ - public ContainerBreakLeaseHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerChangeLeaseHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainerChangeLeaseHeaders.java deleted file mode 100644 index 880214fc46b52..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerChangeLeaseHeaders.java +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for ChangeLease operation. - */ -@JacksonXmlRootElement(localName = "Container-ChangeLease-Headers") -public final class ContainerChangeLeaseHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * Uniquely identifies a container's lease - */ - @JsonProperty(value = "x-ms-lease-id") - private String leaseId; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the ContainerChangeLeaseHeaders object itself. - */ - public ContainerChangeLeaseHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the ContainerChangeLeaseHeaders object itself. - */ - public ContainerChangeLeaseHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the leaseId property: Uniquely identifies a container's lease. - * - * @return the leaseId value. - */ - public String leaseId() { - return this.leaseId; - } - - /** - * Set the leaseId property: Uniquely identifies a container's lease. - * - * @param leaseId the leaseId value to set. - * @return the ContainerChangeLeaseHeaders object itself. - */ - public ContainerChangeLeaseHeaders leaseId(String leaseId) { - this.leaseId = leaseId; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ContainerChangeLeaseHeaders object itself. - */ - public ContainerChangeLeaseHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ContainerChangeLeaseHeaders object itself. - */ - public ContainerChangeLeaseHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ContainerChangeLeaseHeaders object itself. - */ - public ContainerChangeLeaseHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ContainerChangeLeaseHeaders object itself. - */ - public ContainerChangeLeaseHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerCreateHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainerCreateHeaders.java deleted file mode 100644 index 280734c615016..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerCreateHeaders.java +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Create operation. - */ -@JacksonXmlRootElement(localName = "Container-Create-Headers") -public final class ContainerCreateHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the ContainerCreateHeaders object itself. - */ - public ContainerCreateHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the ContainerCreateHeaders object itself. - */ - public ContainerCreateHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ContainerCreateHeaders object itself. - */ - public ContainerCreateHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ContainerCreateHeaders object itself. - */ - public ContainerCreateHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ContainerCreateHeaders object itself. - */ - public ContainerCreateHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ContainerCreateHeaders object itself. - */ - public ContainerCreateHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerDeleteHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainerDeleteHeaders.java deleted file mode 100644 index 52f2623a635d5..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerDeleteHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Delete operation. - */ -@JacksonXmlRootElement(localName = "Container-Delete-Headers") -public final class ContainerDeleteHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ContainerDeleteHeaders object itself. - */ - public ContainerDeleteHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ContainerDeleteHeaders object itself. - */ - public ContainerDeleteHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ContainerDeleteHeaders object itself. - */ - public ContainerDeleteHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ContainerDeleteHeaders object itself. - */ - public ContainerDeleteHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java deleted file mode 100644 index 4905b3c2949fe..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerGetAccessPolicyHeaders.java +++ /dev/null @@ -1,243 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for GetAccessPolicy operation. - */ -@JacksonXmlRootElement(localName = "Container-GetAccessPolicy-Headers") -public final class ContainerGetAccessPolicyHeaders { - /* - * Indicated whether data in the container may be accessed publicly and the - * level of access. Possible values include: 'container', 'blob' - */ - @JsonProperty(value = "x-ms-blob-public-access") - private PublicAccessType blobPublicAccess; - - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the blobPublicAccess property: Indicated whether data in the - * container may be accessed publicly and the level of access. Possible - * values include: 'container', 'blob'. - * - * @return the blobPublicAccess value. - */ - public PublicAccessType blobPublicAccess() { - return this.blobPublicAccess; - } - - /** - * Set the blobPublicAccess property: Indicated whether data in the - * container may be accessed publicly and the level of access. Possible - * values include: 'container', 'blob'. - * - * @param blobPublicAccess the blobPublicAccess value to set. - * @return the ContainerGetAccessPolicyHeaders object itself. - */ - public ContainerGetAccessPolicyHeaders blobPublicAccess(PublicAccessType blobPublicAccess) { - this.blobPublicAccess = blobPublicAccess; - return this; - } - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the ContainerGetAccessPolicyHeaders object itself. - */ - public ContainerGetAccessPolicyHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the ContainerGetAccessPolicyHeaders object itself. - */ - public ContainerGetAccessPolicyHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ContainerGetAccessPolicyHeaders object itself. - */ - public ContainerGetAccessPolicyHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ContainerGetAccessPolicyHeaders object itself. - */ - public ContainerGetAccessPolicyHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ContainerGetAccessPolicyHeaders object itself. - */ - public ContainerGetAccessPolicyHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ContainerGetAccessPolicyHeaders object itself. - */ - public ContainerGetAccessPolicyHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java deleted file mode 100644 index c82baa2c1a6b7..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerGetAccountInfoHeaders.java +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for GetAccountInfo operation. - */ -@JacksonXmlRootElement(localName = "Container-GetAccountInfo-Headers") -public final class ContainerGetAccountInfoHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * Identifies the sku name of the account. Possible values include: - * 'Standard_LRS', 'Standard_GRS', 'Standard_RAGRS', 'Standard_ZRS', - * 'Premium_LRS' - */ - @JsonProperty(value = "x-ms-sku-name") - private SkuName skuName; - - /* - * Identifies the account kind. Possible values include: 'Storage', - * 'BlobStorage', 'StorageV2' - */ - @JsonProperty(value = "x-ms-account-kind") - private AccountKind accountKind; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ContainerGetAccountInfoHeaders object itself. - */ - public ContainerGetAccountInfoHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ContainerGetAccountInfoHeaders object itself. - */ - public ContainerGetAccountInfoHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ContainerGetAccountInfoHeaders object itself. - */ - public ContainerGetAccountInfoHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the skuName property: Identifies the sku name of the account. - * Possible values include: 'Standard_LRS', 'Standard_GRS', - * 'Standard_RAGRS', 'Standard_ZRS', 'Premium_LRS'. - * - * @return the skuName value. - */ - public SkuName skuName() { - return this.skuName; - } - - /** - * Set the skuName property: Identifies the sku name of the account. - * Possible values include: 'Standard_LRS', 'Standard_GRS', - * 'Standard_RAGRS', 'Standard_ZRS', 'Premium_LRS'. - * - * @param skuName the skuName value to set. - * @return the ContainerGetAccountInfoHeaders object itself. - */ - public ContainerGetAccountInfoHeaders skuName(SkuName skuName) { - this.skuName = skuName; - return this; - } - - /** - * Get the accountKind property: Identifies the account kind. Possible - * values include: 'Storage', 'BlobStorage', 'StorageV2'. - * - * @return the accountKind value. - */ - public AccountKind accountKind() { - return this.accountKind; - } - - /** - * Set the accountKind property: Identifies the account kind. Possible - * values include: 'Storage', 'BlobStorage', 'StorageV2'. - * - * @param accountKind the accountKind value to set. - * @return the ContainerGetAccountInfoHeaders object itself. - */ - public ContainerGetAccountInfoHeaders accountKind(AccountKind accountKind) { - this.accountKind = accountKind; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ContainerGetAccountInfoHeaders object itself. - */ - public ContainerGetAccountInfoHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerGetPropertiesHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainerGetPropertiesHeaders.java deleted file mode 100644 index b37286c1b7af3..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerGetPropertiesHeaders.java +++ /dev/null @@ -1,416 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.annotations.HeaderCollection; -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; -import java.util.Map; - -/** - * Defines headers for GetProperties operation. - */ -@JacksonXmlRootElement(localName = "Container-GetProperties-Headers") -public final class ContainerGetPropertiesHeaders { - /* - * The metadata property. - */ - @HeaderCollection("x-ms-meta-") - private Map metadata; - - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * When a blob is leased, specifies whether the lease is of infinite or - * fixed duration. Possible values include: 'infinite', 'fixed' - */ - @JsonProperty(value = "x-ms-lease-duration") - private LeaseDurationType leaseDuration; - - /* - * Lease state of the blob. Possible values include: 'available', 'leased', - * 'expired', 'breaking', 'broken' - */ - @JsonProperty(value = "x-ms-lease-state") - private LeaseStateType leaseState; - - /* - * The current lease status of the blob. Possible values include: 'locked', - * 'unlocked' - */ - @JsonProperty(value = "x-ms-lease-status") - private LeaseStatusType leaseStatus; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * Indicated whether data in the container may be accessed publicly and the - * level of access. Possible values include: 'container', 'blob' - */ - @JsonProperty(value = "x-ms-blob-public-access") - private PublicAccessType blobPublicAccess; - - /* - * Indicates whether the container has an immutability policy set on it. - */ - @JsonProperty(value = "x-ms-has-immutability-policy") - private Boolean hasImmutabilityPolicy; - - /* - * Indicates whether the container has a legal hold. - */ - @JsonProperty(value = "x-ms-has-legal-hold") - private Boolean hasLegalHold; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the metadata property: The metadata property. - * - * @return the metadata value. - */ - public Map metadata() { - return this.metadata; - } - - /** - * Set the metadata property: The metadata property. - * - * @param metadata the metadata value to set. - * @return the ContainerGetPropertiesHeaders object itself. - */ - public ContainerGetPropertiesHeaders metadata(Map metadata) { - this.metadata = metadata; - return this; - } - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the ContainerGetPropertiesHeaders object itself. - */ - public ContainerGetPropertiesHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the ContainerGetPropertiesHeaders object itself. - */ - public ContainerGetPropertiesHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the leaseDuration property: When a blob is leased, specifies whether - * the lease is of infinite or fixed duration. Possible values include: - * 'infinite', 'fixed'. - * - * @return the leaseDuration value. - */ - public LeaseDurationType leaseDuration() { - return this.leaseDuration; - } - - /** - * Set the leaseDuration property: When a blob is leased, specifies whether - * the lease is of infinite or fixed duration. Possible values include: - * 'infinite', 'fixed'. - * - * @param leaseDuration the leaseDuration value to set. - * @return the ContainerGetPropertiesHeaders object itself. - */ - public ContainerGetPropertiesHeaders leaseDuration(LeaseDurationType leaseDuration) { - this.leaseDuration = leaseDuration; - return this; - } - - /** - * Get the leaseState property: Lease state of the blob. Possible values - * include: 'available', 'leased', 'expired', 'breaking', 'broken'. - * - * @return the leaseState value. - */ - public LeaseStateType leaseState() { - return this.leaseState; - } - - /** - * Set the leaseState property: Lease state of the blob. Possible values - * include: 'available', 'leased', 'expired', 'breaking', 'broken'. - * - * @param leaseState the leaseState value to set. - * @return the ContainerGetPropertiesHeaders object itself. - */ - public ContainerGetPropertiesHeaders leaseState(LeaseStateType leaseState) { - this.leaseState = leaseState; - return this; - } - - /** - * Get the leaseStatus property: The current lease status of the blob. - * Possible values include: 'locked', 'unlocked'. - * - * @return the leaseStatus value. - */ - public LeaseStatusType leaseStatus() { - return this.leaseStatus; - } - - /** - * Set the leaseStatus property: The current lease status of the blob. - * Possible values include: 'locked', 'unlocked'. - * - * @param leaseStatus the leaseStatus value to set. - * @return the ContainerGetPropertiesHeaders object itself. - */ - public ContainerGetPropertiesHeaders leaseStatus(LeaseStatusType leaseStatus) { - this.leaseStatus = leaseStatus; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ContainerGetPropertiesHeaders object itself. - */ - public ContainerGetPropertiesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ContainerGetPropertiesHeaders object itself. - */ - public ContainerGetPropertiesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ContainerGetPropertiesHeaders object itself. - */ - public ContainerGetPropertiesHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the blobPublicAccess property: Indicated whether data in the - * container may be accessed publicly and the level of access. Possible - * values include: 'container', 'blob'. - * - * @return the blobPublicAccess value. - */ - public PublicAccessType blobPublicAccess() { - return this.blobPublicAccess; - } - - /** - * Set the blobPublicAccess property: Indicated whether data in the - * container may be accessed publicly and the level of access. Possible - * values include: 'container', 'blob'. - * - * @param blobPublicAccess the blobPublicAccess value to set. - * @return the ContainerGetPropertiesHeaders object itself. - */ - public ContainerGetPropertiesHeaders blobPublicAccess(PublicAccessType blobPublicAccess) { - this.blobPublicAccess = blobPublicAccess; - return this; - } - - /** - * Get the hasImmutabilityPolicy property: Indicates whether the container - * has an immutability policy set on it. - * - * @return the hasImmutabilityPolicy value. - */ - public Boolean hasImmutabilityPolicy() { - return this.hasImmutabilityPolicy; - } - - /** - * Set the hasImmutabilityPolicy property: Indicates whether the container - * has an immutability policy set on it. - * - * @param hasImmutabilityPolicy the hasImmutabilityPolicy value to set. - * @return the ContainerGetPropertiesHeaders object itself. - */ - public ContainerGetPropertiesHeaders hasImmutabilityPolicy(Boolean hasImmutabilityPolicy) { - this.hasImmutabilityPolicy = hasImmutabilityPolicy; - return this; - } - - /** - * Get the hasLegalHold property: Indicates whether the container has a - * legal hold. - * - * @return the hasLegalHold value. - */ - public Boolean hasLegalHold() { - return this.hasLegalHold; - } - - /** - * Set the hasLegalHold property: Indicates whether the container has a - * legal hold. - * - * @param hasLegalHold the hasLegalHold value to set. - * @return the ContainerGetPropertiesHeaders object itself. - */ - public ContainerGetPropertiesHeaders hasLegalHold(Boolean hasLegalHold) { - this.hasLegalHold = hasLegalHold; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ContainerGetPropertiesHeaders object itself. - */ - public ContainerGetPropertiesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerItem.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainerItem.java deleted file mode 100644 index a334568661eb1..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerItem.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.Map; - -/** - * An Azure Storage container. - */ -@JacksonXmlRootElement(localName = "Container") -public final class ContainerItem { - /* - * The name property. - */ - @JsonProperty(value = "Name", required = true) - private String name; - - /* - * The properties property. - */ - @JsonProperty(value = "Properties", required = true) - private ContainerProperties properties; - - /* - * The metadata property. - */ - @JsonProperty(value = "Metadata") - private Map metadata; - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: The name property. - * - * @param name the name value to set. - * @return the ContainerItem object itself. - */ - public ContainerItem name(String name) { - this.name = name; - return this; - } - - /** - * Get the properties property: The properties property. - * - * @return the properties value. - */ - public ContainerProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The properties property. - * - * @param properties the properties value to set. - * @return the ContainerItem object itself. - */ - public ContainerItem properties(ContainerProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the metadata property: The metadata property. - * - * @return the metadata value. - */ - public Map metadata() { - return this.metadata; - } - - /** - * Set the metadata property: The metadata property. - * - * @param metadata the metadata value to set. - * @return the ContainerItem object itself. - */ - public ContainerItem metadata(Map metadata) { - this.metadata = metadata; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java deleted file mode 100644 index 311c0c6ca66bf..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerListBlobFlatSegmentHeaders.java +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for ListBlobFlatSegment operation. - */ -@JacksonXmlRootElement(localName = "Container-ListBlobFlatSegment-Headers") -public final class ContainerListBlobFlatSegmentHeaders { - /* - * The media type of the body of the response. For List Blobs this is - * 'application/xml' - */ - @JsonProperty(value = "Content-Type") - private String contentType; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the contentType property: The media type of the body of the - * response. For List Blobs this is 'application/xml'. - * - * @return the contentType value. - */ - public String contentType() { - return this.contentType; - } - - /** - * Set the contentType property: The media type of the body of the - * response. For List Blobs this is 'application/xml'. - * - * @param contentType the contentType value to set. - * @return the ContainerListBlobFlatSegmentHeaders object itself. - */ - public ContainerListBlobFlatSegmentHeaders contentType(String contentType) { - this.contentType = contentType; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ContainerListBlobFlatSegmentHeaders object itself. - */ - public ContainerListBlobFlatSegmentHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ContainerListBlobFlatSegmentHeaders object itself. - */ - public ContainerListBlobFlatSegmentHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ContainerListBlobFlatSegmentHeaders object itself. - */ - public ContainerListBlobFlatSegmentHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ContainerListBlobFlatSegmentHeaders object itself. - */ - public ContainerListBlobFlatSegmentHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java deleted file mode 100644 index 7456e14d89809..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerListBlobHierarchySegmentHeaders.java +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for ListBlobHierarchySegment operation. - */ -@JacksonXmlRootElement(localName = "Container-ListBlobHierarchySegment-Headers") -public final class ContainerListBlobHierarchySegmentHeaders { - /* - * The media type of the body of the response. For List Blobs this is - * 'application/xml' - */ - @JsonProperty(value = "Content-Type") - private String contentType; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the contentType property: The media type of the body of the - * response. For List Blobs this is 'application/xml'. - * - * @return the contentType value. - */ - public String contentType() { - return this.contentType; - } - - /** - * Set the contentType property: The media type of the body of the - * response. For List Blobs this is 'application/xml'. - * - * @param contentType the contentType value to set. - * @return the ContainerListBlobHierarchySegmentHeaders object itself. - */ - public ContainerListBlobHierarchySegmentHeaders contentType(String contentType) { - this.contentType = contentType; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ContainerListBlobHierarchySegmentHeaders object itself. - */ - public ContainerListBlobHierarchySegmentHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ContainerListBlobHierarchySegmentHeaders object itself. - */ - public ContainerListBlobHierarchySegmentHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ContainerListBlobHierarchySegmentHeaders object itself. - */ - public ContainerListBlobHierarchySegmentHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ContainerListBlobHierarchySegmentHeaders object itself. - */ - public ContainerListBlobHierarchySegmentHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerProperties.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainerProperties.java deleted file mode 100644 index b4844ac52dcfb..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerProperties.java +++ /dev/null @@ -1,242 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Properties of a container. - */ -@JacksonXmlRootElement(localName = "ContainerProperties") -public final class ContainerProperties { - /* - * The lastModified property. - */ - @JsonProperty(value = "Last-Modified", required = true) - private DateTimeRfc1123 lastModified; - - /* - * The etag property. - */ - @JsonProperty(value = "Etag", required = true) - private String etag; - - /* - * Possible values include: 'locked', 'unlocked' - */ - @JsonProperty(value = "LeaseStatus") - private LeaseStatusType leaseStatus; - - /* - * Possible values include: 'available', 'leased', 'expired', 'breaking', - * 'broken' - */ - @JsonProperty(value = "LeaseState") - private LeaseStateType leaseState; - - /* - * Possible values include: 'infinite', 'fixed' - */ - @JsonProperty(value = "LeaseDuration") - private LeaseDurationType leaseDuration; - - /* - * Possible values include: 'container', 'blob' - */ - @JsonProperty(value = "PublicAccess") - private PublicAccessType publicAccess; - - /* - * The hasImmutabilityPolicy property. - */ - @JsonProperty(value = "HasImmutabilityPolicy") - private Boolean hasImmutabilityPolicy; - - /* - * The hasLegalHold property. - */ - @JsonProperty(value = "HasLegalHold") - private Boolean hasLegalHold; - - /** - * Get the lastModified property: The lastModified property. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: The lastModified property. - * - * @param lastModified the lastModified value to set. - * @return the ContainerProperties object itself. - */ - public ContainerProperties lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the etag property: The etag property. - * - * @return the etag value. - */ - public String etag() { - return this.etag; - } - - /** - * Set the etag property: The etag property. - * - * @param etag the etag value to set. - * @return the ContainerProperties object itself. - */ - public ContainerProperties etag(String etag) { - this.etag = etag; - return this; - } - - /** - * Get the leaseStatus property: Possible values include: 'locked', - * 'unlocked'. - * - * @return the leaseStatus value. - */ - public LeaseStatusType leaseStatus() { - return this.leaseStatus; - } - - /** - * Set the leaseStatus property: Possible values include: 'locked', - * 'unlocked'. - * - * @param leaseStatus the leaseStatus value to set. - * @return the ContainerProperties object itself. - */ - public ContainerProperties leaseStatus(LeaseStatusType leaseStatus) { - this.leaseStatus = leaseStatus; - return this; - } - - /** - * Get the leaseState property: Possible values include: 'available', - * 'leased', 'expired', 'breaking', 'broken'. - * - * @return the leaseState value. - */ - public LeaseStateType leaseState() { - return this.leaseState; - } - - /** - * Set the leaseState property: Possible values include: 'available', - * 'leased', 'expired', 'breaking', 'broken'. - * - * @param leaseState the leaseState value to set. - * @return the ContainerProperties object itself. - */ - public ContainerProperties leaseState(LeaseStateType leaseState) { - this.leaseState = leaseState; - return this; - } - - /** - * Get the leaseDuration property: Possible values include: 'infinite', - * 'fixed'. - * - * @return the leaseDuration value. - */ - public LeaseDurationType leaseDuration() { - return this.leaseDuration; - } - - /** - * Set the leaseDuration property: Possible values include: 'infinite', - * 'fixed'. - * - * @param leaseDuration the leaseDuration value to set. - * @return the ContainerProperties object itself. - */ - public ContainerProperties leaseDuration(LeaseDurationType leaseDuration) { - this.leaseDuration = leaseDuration; - return this; - } - - /** - * Get the publicAccess property: Possible values include: 'container', - * 'blob'. - * - * @return the publicAccess value. - */ - public PublicAccessType publicAccess() { - return this.publicAccess; - } - - /** - * Set the publicAccess property: Possible values include: 'container', - * 'blob'. - * - * @param publicAccess the publicAccess value to set. - * @return the ContainerProperties object itself. - */ - public ContainerProperties publicAccess(PublicAccessType publicAccess) { - this.publicAccess = publicAccess; - return this; - } - - /** - * Get the hasImmutabilityPolicy property: The hasImmutabilityPolicy - * property. - * - * @return the hasImmutabilityPolicy value. - */ - public Boolean hasImmutabilityPolicy() { - return this.hasImmutabilityPolicy; - } - - /** - * Set the hasImmutabilityPolicy property: The hasImmutabilityPolicy - * property. - * - * @param hasImmutabilityPolicy the hasImmutabilityPolicy value to set. - * @return the ContainerProperties object itself. - */ - public ContainerProperties hasImmutabilityPolicy(Boolean hasImmutabilityPolicy) { - this.hasImmutabilityPolicy = hasImmutabilityPolicy; - return this; - } - - /** - * Get the hasLegalHold property: The hasLegalHold property. - * - * @return the hasLegalHold value. - */ - public Boolean hasLegalHold() { - return this.hasLegalHold; - } - - /** - * Set the hasLegalHold property: The hasLegalHold property. - * - * @param hasLegalHold the hasLegalHold value to set. - * @return the ContainerProperties object itself. - */ - public ContainerProperties hasLegalHold(Boolean hasLegalHold) { - this.hasLegalHold = hasLegalHold; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java deleted file mode 100644 index b437d814e16ca..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerReleaseLeaseHeaders.java +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for ReleaseLease operation. - */ -@JacksonXmlRootElement(localName = "Container-ReleaseLease-Headers") -public final class ContainerReleaseLeaseHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the ContainerReleaseLeaseHeaders object itself. - */ - public ContainerReleaseLeaseHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the ContainerReleaseLeaseHeaders object itself. - */ - public ContainerReleaseLeaseHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ContainerReleaseLeaseHeaders object itself. - */ - public ContainerReleaseLeaseHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ContainerReleaseLeaseHeaders object itself. - */ - public ContainerReleaseLeaseHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ContainerReleaseLeaseHeaders object itself. - */ - public ContainerReleaseLeaseHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ContainerReleaseLeaseHeaders object itself. - */ - public ContainerReleaseLeaseHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerRenewLeaseHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainerRenewLeaseHeaders.java deleted file mode 100644 index e9a03210ae1a3..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerRenewLeaseHeaders.java +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for RenewLease operation. - */ -@JacksonXmlRootElement(localName = "Container-RenewLease-Headers") -public final class ContainerRenewLeaseHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * Uniquely identifies a container's lease - */ - @JsonProperty(value = "x-ms-lease-id") - private String leaseId; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the ContainerRenewLeaseHeaders object itself. - */ - public ContainerRenewLeaseHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the ContainerRenewLeaseHeaders object itself. - */ - public ContainerRenewLeaseHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the leaseId property: Uniquely identifies a container's lease. - * - * @return the leaseId value. - */ - public String leaseId() { - return this.leaseId; - } - - /** - * Set the leaseId property: Uniquely identifies a container's lease. - * - * @param leaseId the leaseId value to set. - * @return the ContainerRenewLeaseHeaders object itself. - */ - public ContainerRenewLeaseHeaders leaseId(String leaseId) { - this.leaseId = leaseId; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ContainerRenewLeaseHeaders object itself. - */ - public ContainerRenewLeaseHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ContainerRenewLeaseHeaders object itself. - */ - public ContainerRenewLeaseHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ContainerRenewLeaseHeaders object itself. - */ - public ContainerRenewLeaseHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ContainerRenewLeaseHeaders object itself. - */ - public ContainerRenewLeaseHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java deleted file mode 100644 index a91ceed6d34d1..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerSetAccessPolicyHeaders.java +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for SetAccessPolicy operation. - */ -@JacksonXmlRootElement(localName = "Container-SetAccessPolicy-Headers") -public final class ContainerSetAccessPolicyHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the ContainerSetAccessPolicyHeaders object itself. - */ - public ContainerSetAccessPolicyHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the ContainerSetAccessPolicyHeaders object itself. - */ - public ContainerSetAccessPolicyHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ContainerSetAccessPolicyHeaders object itself. - */ - public ContainerSetAccessPolicyHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ContainerSetAccessPolicyHeaders object itself. - */ - public ContainerSetAccessPolicyHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ContainerSetAccessPolicyHeaders object itself. - */ - public ContainerSetAccessPolicyHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ContainerSetAccessPolicyHeaders object itself. - */ - public ContainerSetAccessPolicyHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerSetMetadataHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainerSetMetadataHeaders.java deleted file mode 100644 index 082886b7c0b54..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainerSetMetadataHeaders.java +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for SetMetadata operation. - */ -@JacksonXmlRootElement(localName = "Container-SetMetadata-Headers") -public final class ContainerSetMetadataHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the ContainerSetMetadataHeaders object itself. - */ - public ContainerSetMetadataHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the ContainerSetMetadataHeaders object itself. - */ - public ContainerSetMetadataHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ContainerSetMetadataHeaders object itself. - */ - public ContainerSetMetadataHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ContainerSetMetadataHeaders object itself. - */ - public ContainerSetMetadataHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ContainerSetMetadataHeaders object itself. - */ - public ContainerSetMetadataHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ContainerSetMetadataHeaders object itself. - */ - public ContainerSetMetadataHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersAcquireLeaseResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainersAcquireLeaseResponse.java deleted file mode 100644 index 121be655fcb41..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersAcquireLeaseResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the acquireLease operation. - */ -public final class ContainersAcquireLeaseResponse extends ResponseBase { - /** - * Creates an instance of ContainersAcquireLeaseResponse. - * - * @param request the request which resulted in this ContainersAcquireLeaseResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ContainersAcquireLeaseResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ContainerAcquireLeaseHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersBreakLeaseResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainersBreakLeaseResponse.java deleted file mode 100644 index c1fd19e3b28f3..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersBreakLeaseResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the breakLease operation. - */ -public final class ContainersBreakLeaseResponse extends ResponseBase { - /** - * Creates an instance of ContainersBreakLeaseResponse. - * - * @param request the request which resulted in this ContainersBreakLeaseResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ContainersBreakLeaseResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ContainerBreakLeaseHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersChangeLeaseResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainersChangeLeaseResponse.java deleted file mode 100644 index c89bb3bc9d032..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersChangeLeaseResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the changeLease operation. - */ -public final class ContainersChangeLeaseResponse extends ResponseBase { - /** - * Creates an instance of ContainersChangeLeaseResponse. - * - * @param request the request which resulted in this ContainersChangeLeaseResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ContainersChangeLeaseResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ContainerChangeLeaseHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersCreateResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainersCreateResponse.java deleted file mode 100644 index b08eb783c5533..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersCreateResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the create operation. - */ -public final class ContainersCreateResponse extends ResponseBase { - /** - * Creates an instance of ContainersCreateResponse. - * - * @param request the request which resulted in this ContainersCreateResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ContainersCreateResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ContainerCreateHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersDeleteResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainersDeleteResponse.java deleted file mode 100644 index 62d4bcf04738d..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersDeleteResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the delete operation. - */ -public final class ContainersDeleteResponse extends ResponseBase { - /** - * Creates an instance of ContainersDeleteResponse. - * - * @param request the request which resulted in this ContainersDeleteResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ContainersDeleteResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ContainerDeleteHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersGetAccessPolicyResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainersGetAccessPolicyResponse.java deleted file mode 100644 index 8003bad140ac0..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersGetAccessPolicyResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; -import java.util.List; - -/** - * Contains all response data for the getAccessPolicy operation. - */ -public final class ContainersGetAccessPolicyResponse extends ResponseBase> { - /** - * Creates an instance of ContainersGetAccessPolicyResponse. - * - * @param request the request which resulted in this ContainersGetAccessPolicyResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ContainersGetAccessPolicyResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, List value, ContainerGetAccessPolicyHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public List value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersGetAccountInfoResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainersGetAccountInfoResponse.java deleted file mode 100644 index a4d2a3ab5cc9b..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersGetAccountInfoResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getAccountInfo operation. - */ -public final class ContainersGetAccountInfoResponse extends ResponseBase { - /** - * Creates an instance of ContainersGetAccountInfoResponse. - * - * @param request the request which resulted in this ContainersGetAccountInfoResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ContainersGetAccountInfoResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ContainerGetAccountInfoHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersGetPropertiesResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainersGetPropertiesResponse.java deleted file mode 100644 index fecff3635a11c..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersGetPropertiesResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getProperties operation. - */ -public final class ContainersGetPropertiesResponse extends ResponseBase { - /** - * Creates an instance of ContainersGetPropertiesResponse. - * - * @param request the request which resulted in this ContainersGetPropertiesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ContainersGetPropertiesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ContainerGetPropertiesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersListBlobFlatSegmentResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainersListBlobFlatSegmentResponse.java deleted file mode 100644 index 30a585890905a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersListBlobFlatSegmentResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the listBlobFlatSegment operation. - */ -public final class ContainersListBlobFlatSegmentResponse extends ResponseBase { - /** - * Creates an instance of ContainersListBlobFlatSegmentResponse. - * - * @param request the request which resulted in this ContainersListBlobFlatSegmentResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ContainersListBlobFlatSegmentResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, ListBlobsFlatSegmentResponse value, ContainerListBlobFlatSegmentHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public ListBlobsFlatSegmentResponse value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersListBlobHierarchySegmentResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainersListBlobHierarchySegmentResponse.java deleted file mode 100644 index 2077bc46574e8..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersListBlobHierarchySegmentResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the listBlobHierarchySegment operation. - */ -public final class ContainersListBlobHierarchySegmentResponse extends ResponseBase { - /** - * Creates an instance of ContainersListBlobHierarchySegmentResponse. - * - * @param request the request which resulted in this ContainersListBlobHierarchySegmentResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ContainersListBlobHierarchySegmentResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, ListBlobsHierarchySegmentResponse value, ContainerListBlobHierarchySegmentHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public ListBlobsHierarchySegmentResponse value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersReleaseLeaseResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainersReleaseLeaseResponse.java deleted file mode 100644 index d719090a85c84..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersReleaseLeaseResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the releaseLease operation. - */ -public final class ContainersReleaseLeaseResponse extends ResponseBase { - /** - * Creates an instance of ContainersReleaseLeaseResponse. - * - * @param request the request which resulted in this ContainersReleaseLeaseResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ContainersReleaseLeaseResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ContainerReleaseLeaseHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersRenewLeaseResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainersRenewLeaseResponse.java deleted file mode 100644 index 64ddebe26aa70..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersRenewLeaseResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the renewLease operation. - */ -public final class ContainersRenewLeaseResponse extends ResponseBase { - /** - * Creates an instance of ContainersRenewLeaseResponse. - * - * @param request the request which resulted in this ContainersRenewLeaseResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ContainersRenewLeaseResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ContainerRenewLeaseHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersSetAccessPolicyResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainersSetAccessPolicyResponse.java deleted file mode 100644 index 982160576ba59..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersSetAccessPolicyResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the setAccessPolicy operation. - */ -public final class ContainersSetAccessPolicyResponse extends ResponseBase { - /** - * Creates an instance of ContainersSetAccessPolicyResponse. - * - * @param request the request which resulted in this ContainersSetAccessPolicyResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ContainersSetAccessPolicyResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ContainerSetAccessPolicyHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersSetMetadataResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ContainersSetMetadataResponse.java deleted file mode 100644 index 0fc54a5d1f2c7..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ContainersSetMetadataResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the setMetadata operation. - */ -public final class ContainersSetMetadataResponse extends ResponseBase { - /** - * Creates an instance of ContainersSetMetadataResponse. - * - * @param request the request which resulted in this ContainersSetMetadataResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ContainersSetMetadataResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ContainerSetMetadataHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/CopyStatusType.java b/storage/client/src/main/java/com/azure/storage/blob/models/CopyStatusType.java deleted file mode 100644 index 2400d668cb58d..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/CopyStatusType.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for CopyStatusType. - */ -public enum CopyStatusType { - /** - * Enum value pending. - */ - PENDING("pending"), - - /** - * Enum value success. - */ - SUCCESS("success"), - - /** - * Enum value aborted. - */ - ABORTED("aborted"), - - /** - * Enum value failed. - */ - FAILED("failed"); - - /** - * The actual serialized value for a CopyStatusType instance. - */ - private final String value; - - CopyStatusType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a CopyStatusType instance. - * - * @param value the serialized value to parse. - * @return the parsed CopyStatusType object, or null if unable to parse. - */ - @JsonCreator - public static CopyStatusType fromString(String value) { - CopyStatusType[] items = CopyStatusType.values(); - for (CopyStatusType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/CorsRule.java b/storage/client/src/main/java/com/azure/storage/blob/models/CorsRule.java deleted file mode 100644 index fa9035b072c6c..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/CorsRule.java +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * CORS is an HTTP feature that enables a web application running under one - * domain to access resources in another domain. Web browsers implement a - * security restriction known as same-origin policy that prevents a web page - * from calling APIs in a different domain; CORS provides a secure way to allow - * one domain (the origin domain) to call APIs in another domain. - */ -@JacksonXmlRootElement(localName = "CorsRule") -public final class CorsRule { - /* - * The origin domains that are permitted to make a request against the - * storage service via CORS. The origin domain is the domain from which the - * request originates. Note that the origin must be an exact case-sensitive - * match with the origin that the user age sends to the service. You can - * also use the wildcard character '*' to allow all origin domains to make - * requests via CORS. - */ - @JsonProperty(value = "AllowedOrigins", required = true) - private String allowedOrigins; - - /* - * The methods (HTTP request verbs) that the origin domain may use for a - * CORS request. (comma separated) - */ - @JsonProperty(value = "AllowedMethods", required = true) - private String allowedMethods; - - /* - * the request headers that the origin domain may specify on the CORS - * request. - */ - @JsonProperty(value = "AllowedHeaders", required = true) - private String allowedHeaders; - - /* - * The response headers that may be sent in the response to the CORS - * request and exposed by the browser to the request issuer - */ - @JsonProperty(value = "ExposedHeaders", required = true) - private String exposedHeaders; - - /* - * The maximum amount time that a browser should cache the preflight - * OPTIONS request. - */ - @JsonProperty(value = "MaxAgeInSeconds", required = true) - private int maxAgeInSeconds; - - /** - * Get the allowedOrigins property: The origin domains that are permitted - * to make a request against the storage service via CORS. The origin - * domain is the domain from which the request originates. Note that the - * origin must be an exact case-sensitive match with the origin that the - * user age sends to the service. You can also use the wildcard character - * '*' to allow all origin domains to make requests via CORS. - * - * @return the allowedOrigins value. - */ - public String allowedOrigins() { - return this.allowedOrigins; - } - - /** - * Set the allowedOrigins property: The origin domains that are permitted - * to make a request against the storage service via CORS. The origin - * domain is the domain from which the request originates. Note that the - * origin must be an exact case-sensitive match with the origin that the - * user age sends to the service. You can also use the wildcard character - * '*' to allow all origin domains to make requests via CORS. - * - * @param allowedOrigins the allowedOrigins value to set. - * @return the CorsRule object itself. - */ - public CorsRule allowedOrigins(String allowedOrigins) { - this.allowedOrigins = allowedOrigins; - return this; - } - - /** - * Get the allowedMethods property: The methods (HTTP request verbs) that - * the origin domain may use for a CORS request. (comma separated). - * - * @return the allowedMethods value. - */ - public String allowedMethods() { - return this.allowedMethods; - } - - /** - * Set the allowedMethods property: The methods (HTTP request verbs) that - * the origin domain may use for a CORS request. (comma separated). - * - * @param allowedMethods the allowedMethods value to set. - * @return the CorsRule object itself. - */ - public CorsRule allowedMethods(String allowedMethods) { - this.allowedMethods = allowedMethods; - return this; - } - - /** - * Get the allowedHeaders property: the request headers that the origin - * domain may specify on the CORS request. - * - * @return the allowedHeaders value. - */ - public String allowedHeaders() { - return this.allowedHeaders; - } - - /** - * Set the allowedHeaders property: the request headers that the origin - * domain may specify on the CORS request. - * - * @param allowedHeaders the allowedHeaders value to set. - * @return the CorsRule object itself. - */ - public CorsRule allowedHeaders(String allowedHeaders) { - this.allowedHeaders = allowedHeaders; - return this; - } - - /** - * Get the exposedHeaders property: The response headers that may be sent - * in the response to the CORS request and exposed by the browser to the - * request issuer. - * - * @return the exposedHeaders value. - */ - public String exposedHeaders() { - return this.exposedHeaders; - } - - /** - * Set the exposedHeaders property: The response headers that may be sent - * in the response to the CORS request and exposed by the browser to the - * request issuer. - * - * @param exposedHeaders the exposedHeaders value to set. - * @return the CorsRule object itself. - */ - public CorsRule exposedHeaders(String exposedHeaders) { - this.exposedHeaders = exposedHeaders; - return this; - } - - /** - * Get the maxAgeInSeconds property: The maximum amount time that a browser - * should cache the preflight OPTIONS request. - * - * @return the maxAgeInSeconds value. - */ - public int maxAgeInSeconds() { - return this.maxAgeInSeconds; - } - - /** - * Set the maxAgeInSeconds property: The maximum amount time that a browser - * should cache the preflight OPTIONS request. - * - * @param maxAgeInSeconds the maxAgeInSeconds value to set. - * @return the CorsRule object itself. - */ - public CorsRule maxAgeInSeconds(int maxAgeInSeconds) { - this.maxAgeInSeconds = maxAgeInSeconds; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/DeleteSnapshotsOptionType.java b/storage/client/src/main/java/com/azure/storage/blob/models/DeleteSnapshotsOptionType.java deleted file mode 100644 index 8cfbfd27a66d1..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/DeleteSnapshotsOptionType.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for DeleteSnapshotsOptionType. - */ -public enum DeleteSnapshotsOptionType { - /** - * Enum value include. - */ - INCLUDE("include"), - - /** - * Enum value only. - */ - ONLY("only"); - - /** - * The actual serialized value for a DeleteSnapshotsOptionType instance. - */ - private final String value; - - DeleteSnapshotsOptionType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a DeleteSnapshotsOptionType instance. - * - * @param value the serialized value to parse. - * @return the parsed DeleteSnapshotsOptionType object, or null if unable to parse. - */ - @JsonCreator - public static DeleteSnapshotsOptionType fromString(String value) { - DeleteSnapshotsOptionType[] items = DeleteSnapshotsOptionType.values(); - for (DeleteSnapshotsOptionType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/EncryptionAlgorithmType.java b/storage/client/src/main/java/com/azure/storage/blob/models/EncryptionAlgorithmType.java deleted file mode 100644 index 081f319a2ea47..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/EncryptionAlgorithmType.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for EncryptionAlgorithmType. - */ -public enum EncryptionAlgorithmType { - /** - * Enum value AES256. - */ - AES256("AES256"); - - /** - * The actual serialized value for a EncryptionAlgorithmType instance. - */ - private final String value; - - EncryptionAlgorithmType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a EncryptionAlgorithmType instance. - * - * @param value the serialized value to parse. - * @return the parsed EncryptionAlgorithmType object, or null if unable to parse. - */ - @JsonCreator - public static EncryptionAlgorithmType fromString(String value) { - EncryptionAlgorithmType[] items = EncryptionAlgorithmType.values(); - for (EncryptionAlgorithmType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/GeoReplication.java b/storage/client/src/main/java/com/azure/storage/blob/models/GeoReplication.java deleted file mode 100644 index 90cf41b12f07f..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/GeoReplication.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Geo-Replication information for the Secondary Storage Service. - */ -@JacksonXmlRootElement(localName = "GeoReplication") -public final class GeoReplication { - /* - * The status of the secondary location. Possible values include: 'live', - * 'bootstrap', 'unavailable' - */ - @JsonProperty(value = "Status", required = true) - private GeoReplicationStatusType status; - - /* - * A GMT date/time value, to the second. All primary writes preceding this - * value are guaranteed to be available for read operations at the - * secondary. Primary writes after this point in time may or may not be - * available for reads. - */ - @JsonProperty(value = "LastSyncTime", required = true) - private DateTimeRfc1123 lastSyncTime; - - /** - * Get the status property: The status of the secondary location. Possible - * values include: 'live', 'bootstrap', 'unavailable'. - * - * @return the status value. - */ - public GeoReplicationStatusType status() { - return this.status; - } - - /** - * Set the status property: The status of the secondary location. Possible - * values include: 'live', 'bootstrap', 'unavailable'. - * - * @param status the status value to set. - * @return the GeoReplication object itself. - */ - public GeoReplication status(GeoReplicationStatusType status) { - this.status = status; - return this; - } - - /** - * Get the lastSyncTime property: A GMT date/time value, to the second. All - * primary writes preceding this value are guaranteed to be available for - * read operations at the secondary. Primary writes after this point in - * time may or may not be available for reads. - * - * @return the lastSyncTime value. - */ - public OffsetDateTime lastSyncTime() { - if (this.lastSyncTime == null) { - return null; - } - return this.lastSyncTime.dateTime(); - } - - /** - * Set the lastSyncTime property: A GMT date/time value, to the second. All - * primary writes preceding this value are guaranteed to be available for - * read operations at the secondary. Primary writes after this point in - * time may or may not be available for reads. - * - * @param lastSyncTime the lastSyncTime value to set. - * @return the GeoReplication object itself. - */ - public GeoReplication lastSyncTime(OffsetDateTime lastSyncTime) { - if (lastSyncTime == null) { - this.lastSyncTime = null; - } else { - this.lastSyncTime = new DateTimeRfc1123(lastSyncTime); - } - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/GeoReplicationStatusType.java b/storage/client/src/main/java/com/azure/storage/blob/models/GeoReplicationStatusType.java deleted file mode 100644 index e459bc355f7b4..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/GeoReplicationStatusType.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** - * Defines values for GeoReplicationStatusType. - */ -public final class GeoReplicationStatusType extends ExpandableStringEnum { - /** - * Static value live for GeoReplicationStatusType. - */ - public static final GeoReplicationStatusType LIVE = fromString("live"); - - /** - * Static value bootstrap for GeoReplicationStatusType. - */ - public static final GeoReplicationStatusType BOOTSTRAP = fromString("bootstrap"); - - /** - * Static value unavailable for GeoReplicationStatusType. - */ - public static final GeoReplicationStatusType UNAVAILABLE = fromString("unavailable"); - - /** - * Creates or finds a GeoReplicationStatusType from its string representation. - * - * @param name a name to look for. - * @return the corresponding GeoReplicationStatusType. - */ - @JsonCreator - public static GeoReplicationStatusType fromString(String name) { - return fromString(name, GeoReplicationStatusType.class); - } - - /** - * @return known GeoReplicationStatusType values. - */ - public static Collection values() { - return values(GeoReplicationStatusType.class); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/KeyInfo.java b/storage/client/src/main/java/com/azure/storage/blob/models/KeyInfo.java deleted file mode 100644 index d1aa23bbcef7c..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/KeyInfo.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Key information. - */ -@JacksonXmlRootElement(localName = "KeyInfo") -public final class KeyInfo { - /* - * The date-time the key is active in ISO 8601 UTC time - */ - @JsonProperty(value = "Start", required = true) - private String start; - - /* - * The date-time the key expires in ISO 8601 UTC time - */ - @JsonProperty(value = "Expiry", required = true) - private String expiry; - - /** - * Get the start property: The date-time the key is active in ISO 8601 UTC - * time. - * - * @return the start value. - */ - public String start() { - return this.start; - } - - /** - * Set the start property: The date-time the key is active in ISO 8601 UTC - * time. - * - * @param start the start value to set. - * @return the KeyInfo object itself. - */ - public KeyInfo start(String start) { - this.start = start; - return this; - } - - /** - * Get the expiry property: The date-time the key expires in ISO 8601 UTC - * time. - * - * @return the expiry value. - */ - public String expiry() { - return this.expiry; - } - - /** - * Set the expiry property: The date-time the key expires in ISO 8601 UTC - * time. - * - * @param expiry the expiry value to set. - * @return the KeyInfo object itself. - */ - public KeyInfo expiry(String expiry) { - this.expiry = expiry; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/LeaseAccessConditions.java b/storage/client/src/main/java/com/azure/storage/blob/models/LeaseAccessConditions.java deleted file mode 100644 index eae367a636e25..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/LeaseAccessConditions.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Additional parameters for a set of operations. - */ -@JacksonXmlRootElement(localName = "lease-access-conditions") -public final class LeaseAccessConditions { - /* - * If specified, the operation only succeeds if the resource's lease is - * active and matches this ID. - */ - @JsonProperty(value = "leaseId") - private String leaseId; - - /** - * Get the leaseId property: If specified, the operation only succeeds if - * the resource's lease is active and matches this ID. - * - * @return the leaseId value. - */ - public String leaseId() { - return this.leaseId; - } - - /** - * Set the leaseId property: If specified, the operation only succeeds if - * the resource's lease is active and matches this ID. - * - * @param leaseId the leaseId value to set. - * @return the LeaseAccessConditions object itself. - */ - public LeaseAccessConditions leaseId(String leaseId) { - this.leaseId = leaseId; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/LeaseDurationType.java b/storage/client/src/main/java/com/azure/storage/blob/models/LeaseDurationType.java deleted file mode 100644 index e7b29e0b31e7a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/LeaseDurationType.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for LeaseDurationType. - */ -public enum LeaseDurationType { - /** - * Enum value infinite. - */ - INFINITE("infinite"), - - /** - * Enum value fixed. - */ - FIXED("fixed"); - - /** - * The actual serialized value for a LeaseDurationType instance. - */ - private final String value; - - LeaseDurationType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a LeaseDurationType instance. - * - * @param value the serialized value to parse. - * @return the parsed LeaseDurationType object, or null if unable to parse. - */ - @JsonCreator - public static LeaseDurationType fromString(String value) { - LeaseDurationType[] items = LeaseDurationType.values(); - for (LeaseDurationType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/LeaseStateType.java b/storage/client/src/main/java/com/azure/storage/blob/models/LeaseStateType.java deleted file mode 100644 index 816b541907da6..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/LeaseStateType.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for LeaseStateType. - */ -public enum LeaseStateType { - /** - * Enum value available. - */ - AVAILABLE("available"), - - /** - * Enum value leased. - */ - LEASED("leased"), - - /** - * Enum value expired. - */ - EXPIRED("expired"), - - /** - * Enum value breaking. - */ - BREAKING("breaking"), - - /** - * Enum value broken. - */ - BROKEN("broken"); - - /** - * The actual serialized value for a LeaseStateType instance. - */ - private final String value; - - LeaseStateType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a LeaseStateType instance. - * - * @param value the serialized value to parse. - * @return the parsed LeaseStateType object, or null if unable to parse. - */ - @JsonCreator - public static LeaseStateType fromString(String value) { - LeaseStateType[] items = LeaseStateType.values(); - for (LeaseStateType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/LeaseStatusType.java b/storage/client/src/main/java/com/azure/storage/blob/models/LeaseStatusType.java deleted file mode 100644 index 878b16368817b..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/LeaseStatusType.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for LeaseStatusType. - */ -public enum LeaseStatusType { - /** - * Enum value locked. - */ - LOCKED("locked"), - - /** - * Enum value unlocked. - */ - UNLOCKED("unlocked"); - - /** - * The actual serialized value for a LeaseStatusType instance. - */ - private final String value; - - LeaseStatusType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a LeaseStatusType instance. - * - * @param value the serialized value to parse. - * @return the parsed LeaseStatusType object, or null if unable to parse. - */ - @JsonCreator - public static LeaseStatusType fromString(String value) { - LeaseStatusType[] items = LeaseStatusType.values(); - for (LeaseStatusType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java deleted file mode 100644 index 1807bc8efe364..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ListBlobsFlatSegmentResponse.java +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * An enumeration of blobs. - */ -@JacksonXmlRootElement(localName = "EnumerationResults") -public final class ListBlobsFlatSegmentResponse { - /* - * The serviceEndpoint property. - */ - @JacksonXmlProperty(localName = "ServiceEndpoint", isAttribute = true) - private String serviceEndpoint; - - /* - * The containerName property. - */ - @JacksonXmlProperty(localName = "ContainerName", isAttribute = true) - private String containerName; - - /* - * The prefix property. - */ - @JsonProperty(value = "Prefix", required = true) - private String prefix; - - /* - * The marker property. - */ - @JsonProperty(value = "Marker", required = true) - private String marker; - - /* - * The maxResults property. - */ - @JsonProperty(value = "MaxResults", required = true) - private int maxResults; - - /* - * The delimiter property. - */ - @JsonProperty(value = "Delimiter", required = true) - private String delimiter; - - /* - * The segment property. - */ - @JsonProperty(value = "Blobs", required = true) - private BlobFlatListSegment segment; - - /* - * The nextMarker property. - */ - @JsonProperty(value = "NextMarker", required = true) - private String nextMarker; - - /** - * Get the serviceEndpoint property: The serviceEndpoint property. - * - * @return the serviceEndpoint value. - */ - public String serviceEndpoint() { - return this.serviceEndpoint; - } - - /** - * Set the serviceEndpoint property: The serviceEndpoint property. - * - * @param serviceEndpoint the serviceEndpoint value to set. - * @return the ListBlobsFlatSegmentResponse object itself. - */ - public ListBlobsFlatSegmentResponse serviceEndpoint(String serviceEndpoint) { - this.serviceEndpoint = serviceEndpoint; - return this; - } - - /** - * Get the containerName property: The containerName property. - * - * @return the containerName value. - */ - public String containerName() { - return this.containerName; - } - - /** - * Set the containerName property: The containerName property. - * - * @param containerName the containerName value to set. - * @return the ListBlobsFlatSegmentResponse object itself. - */ - public ListBlobsFlatSegmentResponse containerName(String containerName) { - this.containerName = containerName; - return this; - } - - /** - * Get the prefix property: The prefix property. - * - * @return the prefix value. - */ - public String prefix() { - return this.prefix; - } - - /** - * Set the prefix property: The prefix property. - * - * @param prefix the prefix value to set. - * @return the ListBlobsFlatSegmentResponse object itself. - */ - public ListBlobsFlatSegmentResponse prefix(String prefix) { - this.prefix = prefix; - return this; - } - - /** - * Get the marker property: The marker property. - * - * @return the marker value. - */ - public String marker() { - return this.marker; - } - - /** - * Set the marker property: The marker property. - * - * @param marker the marker value to set. - * @return the ListBlobsFlatSegmentResponse object itself. - */ - public ListBlobsFlatSegmentResponse marker(String marker) { - this.marker = marker; - return this; - } - - /** - * Get the maxResults property: The maxResults property. - * - * @return the maxResults value. - */ - public int maxResults() { - return this.maxResults; - } - - /** - * Set the maxResults property: The maxResults property. - * - * @param maxResults the maxResults value to set. - * @return the ListBlobsFlatSegmentResponse object itself. - */ - public ListBlobsFlatSegmentResponse maxResults(int maxResults) { - this.maxResults = maxResults; - return this; - } - - /** - * Get the delimiter property: The delimiter property. - * - * @return the delimiter value. - */ - public String delimiter() { - return this.delimiter; - } - - /** - * Set the delimiter property: The delimiter property. - * - * @param delimiter the delimiter value to set. - * @return the ListBlobsFlatSegmentResponse object itself. - */ - public ListBlobsFlatSegmentResponse delimiter(String delimiter) { - this.delimiter = delimiter; - return this; - } - - /** - * Get the segment property: The segment property. - * - * @return the segment value. - */ - public BlobFlatListSegment segment() { - return this.segment; - } - - /** - * Set the segment property: The segment property. - * - * @param segment the segment value to set. - * @return the ListBlobsFlatSegmentResponse object itself. - */ - public ListBlobsFlatSegmentResponse segment(BlobFlatListSegment segment) { - this.segment = segment; - return this; - } - - /** - * Get the nextMarker property: The nextMarker property. - * - * @return the nextMarker value. - */ - public String nextMarker() { - return this.nextMarker; - } - - /** - * Set the nextMarker property: The nextMarker property. - * - * @param nextMarker the nextMarker value to set. - * @return the ListBlobsFlatSegmentResponse object itself. - */ - public ListBlobsFlatSegmentResponse nextMarker(String nextMarker) { - this.nextMarker = nextMarker; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java deleted file mode 100644 index f79c285a10796..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ListBlobsHierarchySegmentResponse.java +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * An enumeration of blobs. - */ -@JacksonXmlRootElement(localName = "EnumerationResults") -public final class ListBlobsHierarchySegmentResponse { - /* - * The serviceEndpoint property. - */ - @JacksonXmlProperty(localName = "ServiceEndpoint", isAttribute = true) - private String serviceEndpoint; - - /* - * The containerName property. - */ - @JacksonXmlProperty(localName = "ContainerName", isAttribute = true) - private String containerName; - - /* - * The prefix property. - */ - @JsonProperty(value = "Prefix", required = true) - private String prefix; - - /* - * The marker property. - */ - @JsonProperty(value = "Marker", required = true) - private String marker; - - /* - * The maxResults property. - */ - @JsonProperty(value = "MaxResults", required = true) - private int maxResults; - - /* - * The delimiter property. - */ - @JsonProperty(value = "Delimiter", required = true) - private String delimiter; - - /* - * The segment property. - */ - @JsonProperty(value = "Blobs", required = true) - private BlobHierarchyListSegment segment; - - /* - * The nextMarker property. - */ - @JsonProperty(value = "NextMarker", required = true) - private String nextMarker; - - /** - * Get the serviceEndpoint property: The serviceEndpoint property. - * - * @return the serviceEndpoint value. - */ - public String serviceEndpoint() { - return this.serviceEndpoint; - } - - /** - * Set the serviceEndpoint property: The serviceEndpoint property. - * - * @param serviceEndpoint the serviceEndpoint value to set. - * @return the ListBlobsHierarchySegmentResponse object itself. - */ - public ListBlobsHierarchySegmentResponse serviceEndpoint(String serviceEndpoint) { - this.serviceEndpoint = serviceEndpoint; - return this; - } - - /** - * Get the containerName property: The containerName property. - * - * @return the containerName value. - */ - public String containerName() { - return this.containerName; - } - - /** - * Set the containerName property: The containerName property. - * - * @param containerName the containerName value to set. - * @return the ListBlobsHierarchySegmentResponse object itself. - */ - public ListBlobsHierarchySegmentResponse containerName(String containerName) { - this.containerName = containerName; - return this; - } - - /** - * Get the prefix property: The prefix property. - * - * @return the prefix value. - */ - public String prefix() { - return this.prefix; - } - - /** - * Set the prefix property: The prefix property. - * - * @param prefix the prefix value to set. - * @return the ListBlobsHierarchySegmentResponse object itself. - */ - public ListBlobsHierarchySegmentResponse prefix(String prefix) { - this.prefix = prefix; - return this; - } - - /** - * Get the marker property: The marker property. - * - * @return the marker value. - */ - public String marker() { - return this.marker; - } - - /** - * Set the marker property: The marker property. - * - * @param marker the marker value to set. - * @return the ListBlobsHierarchySegmentResponse object itself. - */ - public ListBlobsHierarchySegmentResponse marker(String marker) { - this.marker = marker; - return this; - } - - /** - * Get the maxResults property: The maxResults property. - * - * @return the maxResults value. - */ - public int maxResults() { - return this.maxResults; - } - - /** - * Set the maxResults property: The maxResults property. - * - * @param maxResults the maxResults value to set. - * @return the ListBlobsHierarchySegmentResponse object itself. - */ - public ListBlobsHierarchySegmentResponse maxResults(int maxResults) { - this.maxResults = maxResults; - return this; - } - - /** - * Get the delimiter property: The delimiter property. - * - * @return the delimiter value. - */ - public String delimiter() { - return this.delimiter; - } - - /** - * Set the delimiter property: The delimiter property. - * - * @param delimiter the delimiter value to set. - * @return the ListBlobsHierarchySegmentResponse object itself. - */ - public ListBlobsHierarchySegmentResponse delimiter(String delimiter) { - this.delimiter = delimiter; - return this; - } - - /** - * Get the segment property: The segment property. - * - * @return the segment value. - */ - public BlobHierarchyListSegment segment() { - return this.segment; - } - - /** - * Set the segment property: The segment property. - * - * @param segment the segment value to set. - * @return the ListBlobsHierarchySegmentResponse object itself. - */ - public ListBlobsHierarchySegmentResponse segment(BlobHierarchyListSegment segment) { - this.segment = segment; - return this; - } - - /** - * Get the nextMarker property: The nextMarker property. - * - * @return the nextMarker value. - */ - public String nextMarker() { - return this.nextMarker; - } - - /** - * Set the nextMarker property: The nextMarker property. - * - * @param nextMarker the nextMarker value to set. - * @return the ListBlobsHierarchySegmentResponse object itself. - */ - public ListBlobsHierarchySegmentResponse nextMarker(String nextMarker) { - this.nextMarker = nextMarker; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ListBlobsIncludeItem.java b/storage/client/src/main/java/com/azure/storage/blob/models/ListBlobsIncludeItem.java deleted file mode 100644 index 47ed4cbfd72f4..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ListBlobsIncludeItem.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for ListBlobsIncludeItem. - */ -public enum ListBlobsIncludeItem { - /** - * Enum value copy. - */ - COPY("copy"), - - /** - * Enum value deleted. - */ - DELETED("deleted"), - - /** - * Enum value metadata. - */ - METADATA("metadata"), - - /** - * Enum value snapshots. - */ - SNAPSHOTS("snapshots"), - - /** - * Enum value uncommittedblobs. - */ - UNCOMMITTEDBLOBS("uncommittedblobs"); - - /** - * The actual serialized value for a ListBlobsIncludeItem instance. - */ - private final String value; - - ListBlobsIncludeItem(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a ListBlobsIncludeItem instance. - * - * @param value the serialized value to parse. - * @return the parsed ListBlobsIncludeItem object, or null if unable to parse. - */ - @JsonCreator - public static ListBlobsIncludeItem fromString(String value) { - ListBlobsIncludeItem[] items = ListBlobsIncludeItem.values(); - for (ListBlobsIncludeItem item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ListContainersIncludeType.java b/storage/client/src/main/java/com/azure/storage/blob/models/ListContainersIncludeType.java deleted file mode 100644 index 692bdc63286bd..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ListContainersIncludeType.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for ListContainersIncludeType. - */ -public enum ListContainersIncludeType { - /** - * Enum value metadata. - */ - METADATA("metadata"); - - /** - * The actual serialized value for a ListContainersIncludeType instance. - */ - private final String value; - - ListContainersIncludeType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a ListContainersIncludeType instance. - * - * @param value the serialized value to parse. - * @return the parsed ListContainersIncludeType object, or null if unable to parse. - */ - @JsonCreator - public static ListContainersIncludeType fromString(String value) { - ListContainersIncludeType[] items = ListContainersIncludeType.values(); - for (ListContainersIncludeType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ListContainersSegmentResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ListContainersSegmentResponse.java deleted file mode 100644 index deafc07a94435..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ListContainersSegmentResponse.java +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.ArrayList; -import java.util.List; - -/** - * An enumeration of containers. - */ -@JacksonXmlRootElement(localName = "EnumerationResults") -public final class ListContainersSegmentResponse { - /* - * The serviceEndpoint property. - */ - @JacksonXmlProperty(localName = "ServiceEndpoint", isAttribute = true) - private String serviceEndpoint; - - /* - * The prefix property. - */ - @JsonProperty(value = "Prefix", required = true) - private String prefix; - - /* - * The marker property. - */ - @JsonProperty(value = "Marker") - private String marker; - - /* - * The maxResults property. - */ - @JsonProperty(value = "MaxResults", required = true) - private int maxResults; - - private static final class ContainersWrapper { - @JacksonXmlProperty(localName = "Container") - private final List items; - - @JsonCreator - private ContainersWrapper(@JacksonXmlProperty(localName = "Container") List items) { - this.items = items; - } - } - - /* - * The containerItems property. - */ - @JsonProperty(value = "Containers", required = true) - private ContainersWrapper containerItems; - - /* - * The nextMarker property. - */ - @JsonProperty(value = "NextMarker", required = true) - private String nextMarker; - - /** - * Get the serviceEndpoint property: The serviceEndpoint property. - * - * @return the serviceEndpoint value. - */ - public String serviceEndpoint() { - return this.serviceEndpoint; - } - - /** - * Set the serviceEndpoint property: The serviceEndpoint property. - * - * @param serviceEndpoint the serviceEndpoint value to set. - * @return the ListContainersSegmentResponse object itself. - */ - public ListContainersSegmentResponse serviceEndpoint(String serviceEndpoint) { - this.serviceEndpoint = serviceEndpoint; - return this; - } - - /** - * Get the prefix property: The prefix property. - * - * @return the prefix value. - */ - public String prefix() { - return this.prefix; - } - - /** - * Set the prefix property: The prefix property. - * - * @param prefix the prefix value to set. - * @return the ListContainersSegmentResponse object itself. - */ - public ListContainersSegmentResponse prefix(String prefix) { - this.prefix = prefix; - return this; - } - - /** - * Get the marker property: The marker property. - * - * @return the marker value. - */ - public String marker() { - return this.marker; - } - - /** - * Set the marker property: The marker property. - * - * @param marker the marker value to set. - * @return the ListContainersSegmentResponse object itself. - */ - public ListContainersSegmentResponse marker(String marker) { - this.marker = marker; - return this; - } - - /** - * Get the maxResults property: The maxResults property. - * - * @return the maxResults value. - */ - public int maxResults() { - return this.maxResults; - } - - /** - * Set the maxResults property: The maxResults property. - * - * @param maxResults the maxResults value to set. - * @return the ListContainersSegmentResponse object itself. - */ - public ListContainersSegmentResponse maxResults(int maxResults) { - this.maxResults = maxResults; - return this; - } - - /** - * Get the containerItems property: The containerItems property. - * - * @return the containerItems value. - */ - public List containerItems() { - if (this.containerItems == null) { - this.containerItems = new ContainersWrapper(new ArrayList()); - } - return this.containerItems.items; - } - - /** - * Set the containerItems property: The containerItems property. - * - * @param containerItems the containerItems value to set. - * @return the ListContainersSegmentResponse object itself. - */ - public ListContainersSegmentResponse containerItems(List containerItems) { - this.containerItems = new ContainersWrapper(containerItems); - return this; - } - - /** - * Get the nextMarker property: The nextMarker property. - * - * @return the nextMarker value. - */ - public String nextMarker() { - return this.nextMarker; - } - - /** - * Set the nextMarker property: The nextMarker property. - * - * @param nextMarker the nextMarker value to set. - * @return the ListContainersSegmentResponse object itself. - */ - public ListContainersSegmentResponse nextMarker(String nextMarker) { - this.nextMarker = nextMarker; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/Logging.java b/storage/client/src/main/java/com/azure/storage/blob/models/Logging.java deleted file mode 100644 index e86ad32a0ae74..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/Logging.java +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Azure Analytics Logging settings. - */ -@JacksonXmlRootElement(localName = "Logging") -public final class Logging { - /* - * The version of Storage Analytics to configure. - */ - @JsonProperty(value = "Version", required = true) - private String version; - - /* - * Indicates whether all delete requests should be logged. - */ - @JsonProperty(value = "Delete", required = true) - private boolean delete; - - /* - * Indicates whether all read requests should be logged. - */ - @JsonProperty(value = "Read", required = true) - private boolean read; - - /* - * Indicates whether all write requests should be logged. - */ - @JsonProperty(value = "Write", required = true) - private boolean write; - - /* - * The retentionPolicy property. - */ - @JsonProperty(value = "RetentionPolicy", required = true) - private RetentionPolicy retentionPolicy; - - /** - * Get the version property: The version of Storage Analytics to configure. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: The version of Storage Analytics to configure. - * - * @param version the version value to set. - * @return the Logging object itself. - */ - public Logging version(String version) { - this.version = version; - return this; - } - - /** - * Get the delete property: Indicates whether all delete requests should be - * logged. - * - * @return the delete value. - */ - public boolean delete() { - return this.delete; - } - - /** - * Set the delete property: Indicates whether all delete requests should be - * logged. - * - * @param delete the delete value to set. - * @return the Logging object itself. - */ - public Logging delete(boolean delete) { - this.delete = delete; - return this; - } - - /** - * Get the read property: Indicates whether all read requests should be - * logged. - * - * @return the read value. - */ - public boolean read() { - return this.read; - } - - /** - * Set the read property: Indicates whether all read requests should be - * logged. - * - * @param read the read value to set. - * @return the Logging object itself. - */ - public Logging read(boolean read) { - this.read = read; - return this; - } - - /** - * Get the write property: Indicates whether all write requests should be - * logged. - * - * @return the write value. - */ - public boolean write() { - return this.write; - } - - /** - * Set the write property: Indicates whether all write requests should be - * logged. - * - * @param write the write value to set. - * @return the Logging object itself. - */ - public Logging write(boolean write) { - this.write = write; - return this; - } - - /** - * Get the retentionPolicy property: The retentionPolicy property. - * - * @return the retentionPolicy value. - */ - public RetentionPolicy retentionPolicy() { - return this.retentionPolicy; - } - - /** - * Set the retentionPolicy property: The retentionPolicy property. - * - * @param retentionPolicy the retentionPolicy value to set. - * @return the Logging object itself. - */ - public Logging retentionPolicy(RetentionPolicy retentionPolicy) { - this.retentionPolicy = retentionPolicy; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/Metrics.java b/storage/client/src/main/java/com/azure/storage/blob/models/Metrics.java deleted file mode 100644 index c812d6a86a533..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/Metrics.java +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * a summary of request statistics grouped by API in hour or minute aggregates - * for blobs. - */ -@JacksonXmlRootElement(localName = "Metrics") -public final class Metrics { - /* - * The version of Storage Analytics to configure. - */ - @JsonProperty(value = "Version") - private String version; - - /* - * Indicates whether metrics are enabled for the Blob service. - */ - @JsonProperty(value = "Enabled", required = true) - private boolean enabled; - - /* - * Indicates whether metrics should generate summary statistics for called - * API operations. - */ - @JsonProperty(value = "IncludeAPIs") - private Boolean includeAPIs; - - /* - * The retentionPolicy property. - */ - @JsonProperty(value = "RetentionPolicy") - private RetentionPolicy retentionPolicy; - - /** - * Get the version property: The version of Storage Analytics to configure. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: The version of Storage Analytics to configure. - * - * @param version the version value to set. - * @return the Metrics object itself. - */ - public Metrics version(String version) { - this.version = version; - return this; - } - - /** - * Get the enabled property: Indicates whether metrics are enabled for the - * Blob service. - * - * @return the enabled value. - */ - public boolean enabled() { - return this.enabled; - } - - /** - * Set the enabled property: Indicates whether metrics are enabled for the - * Blob service. - * - * @param enabled the enabled value to set. - * @return the Metrics object itself. - */ - public Metrics enabled(boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Get the includeAPIs property: Indicates whether metrics should generate - * summary statistics for called API operations. - * - * @return the includeAPIs value. - */ - public Boolean includeAPIs() { - return this.includeAPIs; - } - - /** - * Set the includeAPIs property: Indicates whether metrics should generate - * summary statistics for called API operations. - * - * @param includeAPIs the includeAPIs value to set. - * @return the Metrics object itself. - */ - public Metrics includeAPIs(Boolean includeAPIs) { - this.includeAPIs = includeAPIs; - return this; - } - - /** - * Get the retentionPolicy property: The retentionPolicy property. - * - * @return the retentionPolicy value. - */ - public RetentionPolicy retentionPolicy() { - return this.retentionPolicy; - } - - /** - * Set the retentionPolicy property: The retentionPolicy property. - * - * @param retentionPolicy the retentionPolicy value to set. - * @return the Metrics object itself. - */ - public Metrics retentionPolicy(RetentionPolicy retentionPolicy) { - this.retentionPolicy = retentionPolicy; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ModifiedAccessConditions.java b/storage/client/src/main/java/com/azure/storage/blob/models/ModifiedAccessConditions.java deleted file mode 100644 index 3636dfd4c290c..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ModifiedAccessConditions.java +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Additional parameters for a set of operations. - */ -@JacksonXmlRootElement(localName = "modified-access-conditions") -public final class ModifiedAccessConditions { - /* - * Specify this header value to operate only on a blob if it has been - * modified since the specified date/time. - */ - @JsonProperty(value = "ifModifiedSince") - private DateTimeRfc1123 ifModifiedSince; - - /* - * Specify this header value to operate only on a blob if it has not been - * modified since the specified date/time. - */ - @JsonProperty(value = "ifUnmodifiedSince") - private DateTimeRfc1123 ifUnmodifiedSince; - - /* - * Specify an ETag value to operate only on blobs with a matching value. - */ - @JsonProperty(value = "ifMatch") - private String ifMatch; - - /* - * Specify an ETag value to operate only on blobs without a matching value. - */ - @JsonProperty(value = "ifNoneMatch") - private String ifNoneMatch; - - /** - * Get the ifModifiedSince property: Specify this header value to operate - * only on a blob if it has been modified since the specified date/time. - * - * @return the ifModifiedSince value. - */ - public OffsetDateTime ifModifiedSince() { - if (this.ifModifiedSince == null) { - return null; - } - return this.ifModifiedSince.dateTime(); - } - - /** - * Set the ifModifiedSince property: Specify this header value to operate - * only on a blob if it has been modified since the specified date/time. - * - * @param ifModifiedSince the ifModifiedSince value to set. - * @return the ModifiedAccessConditions object itself. - */ - public ModifiedAccessConditions ifModifiedSince(OffsetDateTime ifModifiedSince) { - if (ifModifiedSince == null) { - this.ifModifiedSince = null; - } else { - this.ifModifiedSince = new DateTimeRfc1123(ifModifiedSince); - } - return this; - } - - /** - * Get the ifUnmodifiedSince property: Specify this header value to operate - * only on a blob if it has not been modified since the specified - * date/time. - * - * @return the ifUnmodifiedSince value. - */ - public OffsetDateTime ifUnmodifiedSince() { - if (this.ifUnmodifiedSince == null) { - return null; - } - return this.ifUnmodifiedSince.dateTime(); - } - - /** - * Set the ifUnmodifiedSince property: Specify this header value to operate - * only on a blob if it has not been modified since the specified - * date/time. - * - * @param ifUnmodifiedSince the ifUnmodifiedSince value to set. - * @return the ModifiedAccessConditions object itself. - */ - public ModifiedAccessConditions ifUnmodifiedSince(OffsetDateTime ifUnmodifiedSince) { - if (ifUnmodifiedSince == null) { - this.ifUnmodifiedSince = null; - } else { - this.ifUnmodifiedSince = new DateTimeRfc1123(ifUnmodifiedSince); - } - return this; - } - - /** - * Get the ifMatch property: Specify an ETag value to operate only on blobs - * with a matching value. - * - * @return the ifMatch value. - */ - public String ifMatch() { - return this.ifMatch; - } - - /** - * Set the ifMatch property: Specify an ETag value to operate only on blobs - * with a matching value. - * - * @param ifMatch the ifMatch value to set. - * @return the ModifiedAccessConditions object itself. - */ - public ModifiedAccessConditions ifMatch(String ifMatch) { - this.ifMatch = ifMatch; - return this; - } - - /** - * Get the ifNoneMatch property: Specify an ETag value to operate only on - * blobs without a matching value. - * - * @return the ifNoneMatch value. - */ - public String ifNoneMatch() { - return this.ifNoneMatch; - } - - /** - * Set the ifNoneMatch property: Specify an ETag value to operate only on - * blobs without a matching value. - * - * @param ifNoneMatch the ifNoneMatch value to set. - * @return the ModifiedAccessConditions object itself. - */ - public ModifiedAccessConditions ifNoneMatch(String ifNoneMatch) { - this.ifNoneMatch = ifNoneMatch; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java deleted file mode 100644 index 45f30cefd53a1..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobClearPagesHeaders.java +++ /dev/null @@ -1,273 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.azure.core.implementation.util.ImplUtils; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for ClearPages operation. - */ -@JacksonXmlRootElement(localName = "PageBlob-ClearPages-Headers") -public final class PageBlobClearPagesHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. - */ - @JsonProperty(value = "Content-MD5") - private byte[] contentMD5; - - /* - * The current sequence number for the page blob. - */ - @JsonProperty(value = "x-ms-blob-sequence-number") - private Long blobSequenceNumber; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the PageBlobClearPagesHeaders object itself. - */ - public PageBlobClearPagesHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the PageBlobClearPagesHeaders object itself. - */ - public PageBlobClearPagesHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @return the contentMD5 value. - */ - public byte[] contentMD5() { - return ImplUtils.clone(this.contentMD5); - } - - /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @param contentMD5 the contentMD5 value to set. - * @return the PageBlobClearPagesHeaders object itself. - */ - public PageBlobClearPagesHeaders contentMD5(byte[] contentMD5) { - this.contentMD5 = ImplUtils.clone(contentMD5); - return this; - } - - /** - * Get the blobSequenceNumber property: The current sequence number for the - * page blob. - * - * @return the blobSequenceNumber value. - */ - public Long blobSequenceNumber() { - return this.blobSequenceNumber; - } - - /** - * Set the blobSequenceNumber property: The current sequence number for the - * page blob. - * - * @param blobSequenceNumber the blobSequenceNumber value to set. - * @return the PageBlobClearPagesHeaders object itself. - */ - public PageBlobClearPagesHeaders blobSequenceNumber(Long blobSequenceNumber) { - this.blobSequenceNumber = blobSequenceNumber; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the PageBlobClearPagesHeaders object itself. - */ - public PageBlobClearPagesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the PageBlobClearPagesHeaders object itself. - */ - public PageBlobClearPagesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the PageBlobClearPagesHeaders object itself. - */ - public PageBlobClearPagesHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the PageBlobClearPagesHeaders object itself. - */ - public PageBlobClearPagesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java deleted file mode 100644 index 3a1ea5cd5f9d7..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobCopyIncrementalHeaders.java +++ /dev/null @@ -1,275 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for CopyIncremental operation. - */ -@JacksonXmlRootElement(localName = "PageBlob-CopyIncremental-Headers") -public final class PageBlobCopyIncrementalHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * String identifier for this copy operation. Use with Get Blob Properties - * to check the status of this copy operation, or pass to Abort Copy Blob - * to abort a pending copy. - */ - @JsonProperty(value = "x-ms-copy-id") - private String copyId; - - /* - * State of the copy operation identified by x-ms-copy-id. Possible values - * include: 'pending', 'success', 'aborted', 'failed' - */ - @JsonProperty(value = "x-ms-copy-status") - private CopyStatusType copyStatus; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the PageBlobCopyIncrementalHeaders object itself. - */ - public PageBlobCopyIncrementalHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the PageBlobCopyIncrementalHeaders object itself. - */ - public PageBlobCopyIncrementalHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the PageBlobCopyIncrementalHeaders object itself. - */ - public PageBlobCopyIncrementalHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the PageBlobCopyIncrementalHeaders object itself. - */ - public PageBlobCopyIncrementalHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the PageBlobCopyIncrementalHeaders object itself. - */ - public PageBlobCopyIncrementalHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the copyId property: String identifier for this copy operation. Use - * with Get Blob Properties to check the status of this copy operation, or - * pass to Abort Copy Blob to abort a pending copy. - * - * @return the copyId value. - */ - public String copyId() { - return this.copyId; - } - - /** - * Set the copyId property: String identifier for this copy operation. Use - * with Get Blob Properties to check the status of this copy operation, or - * pass to Abort Copy Blob to abort a pending copy. - * - * @param copyId the copyId value to set. - * @return the PageBlobCopyIncrementalHeaders object itself. - */ - public PageBlobCopyIncrementalHeaders copyId(String copyId) { - this.copyId = copyId; - return this; - } - - /** - * Get the copyStatus property: State of the copy operation identified by - * x-ms-copy-id. Possible values include: 'pending', 'success', 'aborted', - * 'failed'. - * - * @return the copyStatus value. - */ - public CopyStatusType copyStatus() { - return this.copyStatus; - } - - /** - * Set the copyStatus property: State of the copy operation identified by - * x-ms-copy-id. Possible values include: 'pending', 'success', 'aborted', - * 'failed'. - * - * @param copyStatus the copyStatus value to set. - * @return the PageBlobCopyIncrementalHeaders object itself. - */ - public PageBlobCopyIncrementalHeaders copyStatus(CopyStatusType copyStatus) { - this.copyStatus = copyStatus; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the PageBlobCopyIncrementalHeaders object itself. - */ - public PageBlobCopyIncrementalHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobCreateHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobCreateHeaders.java deleted file mode 100644 index 215c6f4c934aa..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobCreateHeaders.java +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.azure.core.implementation.util.ImplUtils; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Create operation. - */ -@JacksonXmlRootElement(localName = "PageBlob-Create-Headers") -public final class PageBlobCreateHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. - */ - @JsonProperty(value = "Content-MD5") - private byte[] contentMD5; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that identifies a version - * of the blob. This header is returned for requests made against version - * 2018-11-09 and above. - */ - @JsonProperty(value = "x-ms-version-id") - private String versionId; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The value of this header is set to true if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. - */ - @JsonProperty(value = "x-ms-request-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The SHA-256 hash of the encryption key used to encrypt the blob. This - * header is only returned when the blob was encrypted with a - * customer-provided key. - */ - @JsonProperty(value = "x-ms-encryption-key-sha256") - private String encryptionKeySha256; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the PageBlobCreateHeaders object itself. - */ - public PageBlobCreateHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the PageBlobCreateHeaders object itself. - */ - public PageBlobCreateHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @return the contentMD5 value. - */ - public byte[] contentMD5() { - return ImplUtils.clone(this.contentMD5); - } - - /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @param contentMD5 the contentMD5 value to set. - * @return the PageBlobCreateHeaders object itself. - */ - public PageBlobCreateHeaders contentMD5(byte[] contentMD5) { - this.contentMD5 = ImplUtils.clone(contentMD5); - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the PageBlobCreateHeaders object itself. - */ - public PageBlobCreateHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the PageBlobCreateHeaders object itself. - */ - public PageBlobCreateHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @return the versionId value. - */ - public String versionId() { - return this.versionId; - } - - /** - * Set the versionId property: UTC date/time value generated by the service - * that identifies a version of the blob. This header is returned for - * requests made against version 2018-11-09 and above. - * - * @param versionId the versionId value to set. - * @return the PageBlobCreateHeaders object itself. - */ - public PageBlobCreateHeaders versionId(String versionId) { - this.versionId = versionId; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the PageBlobCreateHeaders object itself. - */ - public PageBlobCreateHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the PageBlobCreateHeaders object itself. - */ - public PageBlobCreateHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the blob. This header is only returned when the blob - * was encrypted with a customer-provided key. - * - * @return the encryptionKeySha256 value. - */ - public String encryptionKeySha256() { - return this.encryptionKeySha256; - } - - /** - * Set the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the blob. This header is only returned when the blob - * was encrypted with a customer-provided key. - * - * @param encryptionKeySha256 the encryptionKeySha256 value to set. - * @return the PageBlobCreateHeaders object itself. - */ - public PageBlobCreateHeaders encryptionKeySha256(String encryptionKeySha256) { - this.encryptionKeySha256 = encryptionKeySha256; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the PageBlobCreateHeaders object itself. - */ - public PageBlobCreateHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java deleted file mode 100644 index 5f75cf82af768..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesDiffHeaders.java +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for GetPageRangesDiff operation. - */ -@JacksonXmlRootElement(localName = "PageBlob-GetPageRangesDiff-Headers") -public final class PageBlobGetPageRangesDiffHeaders { - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * The size of the blob in bytes. - */ - @JsonProperty(value = "x-ms-blob-content-length") - private Long blobContentLength; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the PageBlobGetPageRangesDiffHeaders object itself. - */ - public PageBlobGetPageRangesDiffHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the PageBlobGetPageRangesDiffHeaders object itself. - */ - public PageBlobGetPageRangesDiffHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the blobContentLength property: The size of the blob in bytes. - * - * @return the blobContentLength value. - */ - public Long blobContentLength() { - return this.blobContentLength; - } - - /** - * Set the blobContentLength property: The size of the blob in bytes. - * - * @param blobContentLength the blobContentLength value to set. - * @return the PageBlobGetPageRangesDiffHeaders object itself. - */ - public PageBlobGetPageRangesDiffHeaders blobContentLength(Long blobContentLength) { - this.blobContentLength = blobContentLength; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the PageBlobGetPageRangesDiffHeaders object itself. - */ - public PageBlobGetPageRangesDiffHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the PageBlobGetPageRangesDiffHeaders object itself. - */ - public PageBlobGetPageRangesDiffHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the PageBlobGetPageRangesDiffHeaders object itself. - */ - public PageBlobGetPageRangesDiffHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the PageBlobGetPageRangesDiffHeaders object itself. - */ - public PageBlobGetPageRangesDiffHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java deleted file mode 100644 index a9004d8dd2c91..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobGetPageRangesHeaders.java +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for GetPageRanges operation. - */ -@JacksonXmlRootElement(localName = "PageBlob-GetPageRanges-Headers") -public final class PageBlobGetPageRangesHeaders { - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * The size of the blob in bytes. - */ - @JsonProperty(value = "x-ms-blob-content-length") - private Long blobContentLength; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the PageBlobGetPageRangesHeaders object itself. - */ - public PageBlobGetPageRangesHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the PageBlobGetPageRangesHeaders object itself. - */ - public PageBlobGetPageRangesHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the blobContentLength property: The size of the blob in bytes. - * - * @return the blobContentLength value. - */ - public Long blobContentLength() { - return this.blobContentLength; - } - - /** - * Set the blobContentLength property: The size of the blob in bytes. - * - * @param blobContentLength the blobContentLength value to set. - * @return the PageBlobGetPageRangesHeaders object itself. - */ - public PageBlobGetPageRangesHeaders blobContentLength(Long blobContentLength) { - this.blobContentLength = blobContentLength; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the PageBlobGetPageRangesHeaders object itself. - */ - public PageBlobGetPageRangesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the PageBlobGetPageRangesHeaders object itself. - */ - public PageBlobGetPageRangesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the PageBlobGetPageRangesHeaders object itself. - */ - public PageBlobGetPageRangesHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the PageBlobGetPageRangesHeaders object itself. - */ - public PageBlobGetPageRangesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobResizeHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobResizeHeaders.java deleted file mode 100644 index f9396b66835c3..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobResizeHeaders.java +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Resize operation. - */ -@JacksonXmlRootElement(localName = "PageBlob-Resize-Headers") -public final class PageBlobResizeHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * The current sequence number for a page blob. This header is not returned - * for block blobs or append blobs - */ - @JsonProperty(value = "x-ms-blob-sequence-number") - private Long blobSequenceNumber; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the PageBlobResizeHeaders object itself. - */ - public PageBlobResizeHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the PageBlobResizeHeaders object itself. - */ - public PageBlobResizeHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the blobSequenceNumber property: The current sequence number for a - * page blob. This header is not returned for block blobs or append blobs. - * - * @return the blobSequenceNumber value. - */ - public Long blobSequenceNumber() { - return this.blobSequenceNumber; - } - - /** - * Set the blobSequenceNumber property: The current sequence number for a - * page blob. This header is not returned for block blobs or append blobs. - * - * @param blobSequenceNumber the blobSequenceNumber value to set. - * @return the PageBlobResizeHeaders object itself. - */ - public PageBlobResizeHeaders blobSequenceNumber(Long blobSequenceNumber) { - this.blobSequenceNumber = blobSequenceNumber; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the PageBlobResizeHeaders object itself. - */ - public PageBlobResizeHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the PageBlobResizeHeaders object itself. - */ - public PageBlobResizeHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the PageBlobResizeHeaders object itself. - */ - public PageBlobResizeHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the PageBlobResizeHeaders object itself. - */ - public PageBlobResizeHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java deleted file mode 100644 index 317c57bb35cea..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobUpdateSequenceNumberHeaders.java +++ /dev/null @@ -1,241 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for UpdateSequenceNumber operation. - */ -@JacksonXmlRootElement(localName = "PageBlob-UpdateSequenceNumber-Headers") -public final class PageBlobUpdateSequenceNumberHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * The current sequence number for a page blob. This header is not returned - * for block blobs or append blobs - */ - @JsonProperty(value = "x-ms-blob-sequence-number") - private Long blobSequenceNumber; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the PageBlobUpdateSequenceNumberHeaders object itself. - */ - public PageBlobUpdateSequenceNumberHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the PageBlobUpdateSequenceNumberHeaders object itself. - */ - public PageBlobUpdateSequenceNumberHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the blobSequenceNumber property: The current sequence number for a - * page blob. This header is not returned for block blobs or append blobs. - * - * @return the blobSequenceNumber value. - */ - public Long blobSequenceNumber() { - return this.blobSequenceNumber; - } - - /** - * Set the blobSequenceNumber property: The current sequence number for a - * page blob. This header is not returned for block blobs or append blobs. - * - * @param blobSequenceNumber the blobSequenceNumber value to set. - * @return the PageBlobUpdateSequenceNumberHeaders object itself. - */ - public PageBlobUpdateSequenceNumberHeaders blobSequenceNumber(Long blobSequenceNumber) { - this.blobSequenceNumber = blobSequenceNumber; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the PageBlobUpdateSequenceNumberHeaders object itself. - */ - public PageBlobUpdateSequenceNumberHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the PageBlobUpdateSequenceNumberHeaders object itself. - */ - public PageBlobUpdateSequenceNumberHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the PageBlobUpdateSequenceNumberHeaders object itself. - */ - public PageBlobUpdateSequenceNumberHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the PageBlobUpdateSequenceNumberHeaders object itself. - */ - public PageBlobUpdateSequenceNumberHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java deleted file mode 100644 index ad21b582b509e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesFromURLHeaders.java +++ /dev/null @@ -1,305 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.azure.core.implementation.util.ImplUtils; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for UploadPagesFromURL operation. - */ -@JacksonXmlRootElement(localName = "PageBlob-UploadPagesFromURL-Headers") -public final class PageBlobUploadPagesFromURLHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. - */ - @JsonProperty(value = "Content-MD5") - private byte[] contentMD5; - - /* - * The current sequence number for the page blob. - */ - @JsonProperty(value = "x-ms-blob-sequence-number") - private Long blobSequenceNumber; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The value of this header is set to true if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. - */ - @JsonProperty(value = "x-ms-request-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the PageBlobUploadPagesFromURLHeaders object itself. - */ - public PageBlobUploadPagesFromURLHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the PageBlobUploadPagesFromURLHeaders object itself. - */ - public PageBlobUploadPagesFromURLHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @return the contentMD5 value. - */ - public byte[] contentMD5() { - return ImplUtils.clone(this.contentMD5); - } - - /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @param contentMD5 the contentMD5 value to set. - * @return the PageBlobUploadPagesFromURLHeaders object itself. - */ - public PageBlobUploadPagesFromURLHeaders contentMD5(byte[] contentMD5) { - this.contentMD5 = ImplUtils.clone(contentMD5); - return this; - } - - /** - * Get the blobSequenceNumber property: The current sequence number for the - * page blob. - * - * @return the blobSequenceNumber value. - */ - public Long blobSequenceNumber() { - return this.blobSequenceNumber; - } - - /** - * Set the blobSequenceNumber property: The current sequence number for the - * page blob. - * - * @param blobSequenceNumber the blobSequenceNumber value to set. - * @return the PageBlobUploadPagesFromURLHeaders object itself. - */ - public PageBlobUploadPagesFromURLHeaders blobSequenceNumber(Long blobSequenceNumber) { - this.blobSequenceNumber = blobSequenceNumber; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the PageBlobUploadPagesFromURLHeaders object itself. - */ - public PageBlobUploadPagesFromURLHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the PageBlobUploadPagesFromURLHeaders object itself. - */ - public PageBlobUploadPagesFromURLHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the PageBlobUploadPagesFromURLHeaders object itself. - */ - public PageBlobUploadPagesFromURLHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the PageBlobUploadPagesFromURLHeaders object itself. - */ - public PageBlobUploadPagesFromURLHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the PageBlobUploadPagesFromURLHeaders object itself. - */ - public PageBlobUploadPagesFromURLHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesHeaders.java deleted file mode 100644 index 29cf41bae0b8e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobUploadPagesHeaders.java +++ /dev/null @@ -1,337 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.azure.core.implementation.util.ImplUtils; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for UploadPages operation. - */ -@JacksonXmlRootElement(localName = "PageBlob-UploadPages-Headers") -public final class PageBlobUploadPagesHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally. If the request version is 2011-08-18 or newer, the ETag - * value will be in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the container was last modified. Any operation - * that modifies the blob, including an update of the blob's metadata or - * properties, changes the last-modified time of the blob. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * If the blob has an MD5 hash and this operation is to read the full blob, - * this response header is returned so that the client can check for - * message content integrity. - */ - @JsonProperty(value = "Content-MD5") - private byte[] contentMD5; - - /* - * The current sequence number for the page blob. - */ - @JsonProperty(value = "x-ms-blob-sequence-number") - private Long blobSequenceNumber; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The value of this header is set to true if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. - */ - @JsonProperty(value = "x-ms-request-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The SHA-256 hash of the encryption key used to encrypt the pages. This - * header is only returned when the pages were encrypted with a - * customer-provided key. - */ - @JsonProperty(value = "x-ms-encryption-key-sha256") - private String encryptionKeySha256; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally. If the request version is 2011-08-18 - * or newer, the ETag value will be in quotes. - * - * @param eTag the eTag value to set. - * @return the PageBlobUploadPagesHeaders object itself. - */ - public PageBlobUploadPagesHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the container - * was last modified. Any operation that modifies the blob, including an - * update of the blob's metadata or properties, changes the last-modified - * time of the blob. - * - * @param lastModified the lastModified value to set. - * @return the PageBlobUploadPagesHeaders object itself. - */ - public PageBlobUploadPagesHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @return the contentMD5 value. - */ - public byte[] contentMD5() { - return ImplUtils.clone(this.contentMD5); - } - - /** - * Set the contentMD5 property: If the blob has an MD5 hash and this - * operation is to read the full blob, this response header is returned so - * that the client can check for message content integrity. - * - * @param contentMD5 the contentMD5 value to set. - * @return the PageBlobUploadPagesHeaders object itself. - */ - public PageBlobUploadPagesHeaders contentMD5(byte[] contentMD5) { - this.contentMD5 = ImplUtils.clone(contentMD5); - return this; - } - - /** - * Get the blobSequenceNumber property: The current sequence number for the - * page blob. - * - * @return the blobSequenceNumber value. - */ - public Long blobSequenceNumber() { - return this.blobSequenceNumber; - } - - /** - * Set the blobSequenceNumber property: The current sequence number for the - * page blob. - * - * @param blobSequenceNumber the blobSequenceNumber value to set. - * @return the PageBlobUploadPagesHeaders object itself. - */ - public PageBlobUploadPagesHeaders blobSequenceNumber(Long blobSequenceNumber) { - this.blobSequenceNumber = blobSequenceNumber; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the PageBlobUploadPagesHeaders object itself. - */ - public PageBlobUploadPagesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the PageBlobUploadPagesHeaders object itself. - */ - public PageBlobUploadPagesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the PageBlobUploadPagesHeaders object itself. - */ - public PageBlobUploadPagesHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the PageBlobUploadPagesHeaders object itself. - */ - public PageBlobUploadPagesHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the pages. This header is only returned when the - * pages were encrypted with a customer-provided key. - * - * @return the encryptionKeySha256 value. - */ - public String encryptionKeySha256() { - return this.encryptionKeySha256; - } - - /** - * Set the encryptionKeySha256 property: The SHA-256 hash of the encryption - * key used to encrypt the pages. This header is only returned when the - * pages were encrypted with a customer-provided key. - * - * @param encryptionKeySha256 the encryptionKeySha256 value to set. - * @return the PageBlobUploadPagesHeaders object itself. - */ - public PageBlobUploadPagesHeaders encryptionKeySha256(String encryptionKeySha256) { - this.encryptionKeySha256 = encryptionKeySha256; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the PageBlobUploadPagesHeaders object itself. - */ - public PageBlobUploadPagesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsClearPagesResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsClearPagesResponse.java deleted file mode 100644 index b85c5e2dff902..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsClearPagesResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the clearPages operation. - */ -public final class PageBlobsClearPagesResponse extends ResponseBase { - /** - * Creates an instance of PageBlobsClearPagesResponse. - * - * @param request the request which resulted in this PageBlobsClearPagesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public PageBlobsClearPagesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, PageBlobClearPagesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsCopyIncrementalResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsCopyIncrementalResponse.java deleted file mode 100644 index 819c8bbbd8d9b..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsCopyIncrementalResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the copyIncremental operation. - */ -public final class PageBlobsCopyIncrementalResponse extends ResponseBase { - /** - * Creates an instance of PageBlobsCopyIncrementalResponse. - * - * @param request the request which resulted in this PageBlobsCopyIncrementalResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public PageBlobsCopyIncrementalResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, PageBlobCopyIncrementalHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsCreateResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsCreateResponse.java deleted file mode 100644 index 835d537ff9a8b..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsCreateResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the create operation. - */ -public final class PageBlobsCreateResponse extends ResponseBase { - /** - * Creates an instance of PageBlobsCreateResponse. - * - * @param request the request which resulted in this PageBlobsCreateResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public PageBlobsCreateResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, PageBlobCreateHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesDiffResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesDiffResponse.java deleted file mode 100644 index 987b49716aabd..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesDiffResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getPageRangesDiff operation. - */ -public final class PageBlobsGetPageRangesDiffResponse extends ResponseBase { - /** - * Creates an instance of PageBlobsGetPageRangesDiffResponse. - * - * @param request the request which resulted in this PageBlobsGetPageRangesDiffResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public PageBlobsGetPageRangesDiffResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, PageList value, PageBlobGetPageRangesDiffHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public PageList value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesResponse.java deleted file mode 100644 index 0e90e17142621..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsGetPageRangesResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getPageRanges operation. - */ -public final class PageBlobsGetPageRangesResponse extends ResponseBase { - /** - * Creates an instance of PageBlobsGetPageRangesResponse. - * - * @param request the request which resulted in this PageBlobsGetPageRangesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public PageBlobsGetPageRangesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, PageList value, PageBlobGetPageRangesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public PageList value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsResizeResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsResizeResponse.java deleted file mode 100644 index 27f0cb1c38d31..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsResizeResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the resize operation. - */ -public final class PageBlobsResizeResponse extends ResponseBase { - /** - * Creates an instance of PageBlobsResizeResponse. - * - * @param request the request which resulted in this PageBlobsResizeResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public PageBlobsResizeResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, PageBlobResizeHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsUpdateSequenceNumberResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsUpdateSequenceNumberResponse.java deleted file mode 100644 index 3855cd4a7ba58..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsUpdateSequenceNumberResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the updateSequenceNumber operation. - */ -public final class PageBlobsUpdateSequenceNumberResponse extends ResponseBase { - /** - * Creates an instance of PageBlobsUpdateSequenceNumberResponse. - * - * @param request the request which resulted in this PageBlobsUpdateSequenceNumberResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public PageBlobsUpdateSequenceNumberResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, PageBlobUpdateSequenceNumberHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsUploadPagesFromURLResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsUploadPagesFromURLResponse.java deleted file mode 100644 index f21558d5d6bf7..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsUploadPagesFromURLResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the uploadPagesFromURL operation. - */ -public final class PageBlobsUploadPagesFromURLResponse extends ResponseBase { - /** - * Creates an instance of PageBlobsUploadPagesFromURLResponse. - * - * @param request the request which resulted in this PageBlobsUploadPagesFromURLResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public PageBlobsUploadPagesFromURLResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, PageBlobUploadPagesFromURLHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsUploadPagesResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsUploadPagesResponse.java deleted file mode 100644 index 4d0c46ce08ca0..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageBlobsUploadPagesResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the uploadPages operation. - */ -public final class PageBlobsUploadPagesResponse extends ResponseBase { - /** - * Creates an instance of PageBlobsUploadPagesResponse. - * - * @param request the request which resulted in this PageBlobsUploadPagesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public PageBlobsUploadPagesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, PageBlobUploadPagesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageList.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageList.java deleted file mode 100644 index cf921ab92646b..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageList.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.ArrayList; -import java.util.List; - -/** - * the list of pages. - */ -@JacksonXmlRootElement(localName = "PageList") -public final class PageList { - /* - * The pageRange property. - */ - @JsonProperty("PageRange") - private List pageRange = new ArrayList<>(); - - /* - * The clearRange property. - */ - @JsonProperty("ClearRange") - private List clearRange = new ArrayList<>(); - - /** - * Get the pageRange property: The pageRange property. - * - * @return the pageRange value. - */ - public List pageRange() { - return this.pageRange; - } - - /** - * Set the pageRange property: The pageRange property. - * - * @param pageRange the pageRange value to set. - * @return the PageList object itself. - */ - public PageList pageRange(List pageRange) { - this.pageRange = pageRange; - return this; - } - - /** - * Get the clearRange property: The clearRange property. - * - * @return the clearRange value. - */ - public List clearRange() { - return this.clearRange; - } - - /** - * Set the clearRange property: The clearRange property. - * - * @param clearRange the clearRange value to set. - * @return the PageList object itself. - */ - public PageList clearRange(List clearRange) { - this.clearRange = clearRange; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PageRange.java b/storage/client/src/main/java/com/azure/storage/blob/models/PageRange.java deleted file mode 100644 index 5ce78ebfb0db8..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PageRange.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * The PageRange model. - */ -@JacksonXmlRootElement(localName = "PageRange") -public final class PageRange { - /* - * The start property. - */ - @JsonProperty(value = "Start", required = true) - private long start; - - /* - * The end property. - */ - @JsonProperty(value = "End", required = true) - private long end; - - /** - * Get the start property: The start property. - * - * @return the start value. - */ - public long start() { - return this.start; - } - - /** - * Set the start property: The start property. - * - * @param start the start value to set. - * @return the PageRange object itself. - */ - public PageRange start(long start) { - this.start = start; - return this; - } - - /** - * Get the end property: The end property. - * - * @return the end value. - */ - public long end() { - return this.end; - } - - /** - * Set the end property: The end property. - * - * @param end the end value to set. - * @return the PageRange object itself. - */ - public PageRange end(long end) { - this.end = end; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/PublicAccessType.java b/storage/client/src/main/java/com/azure/storage/blob/models/PublicAccessType.java deleted file mode 100644 index 6bc958765fb81..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/PublicAccessType.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** - * Defines values for PublicAccessType. - */ -public final class PublicAccessType extends ExpandableStringEnum { - /** - * Static value container for PublicAccessType. - */ - public static final PublicAccessType CONTAINER = fromString("container"); - - /** - * Static value blob for PublicAccessType. - */ - public static final PublicAccessType BLOB = fromString("blob"); - - /** - * Creates or finds a PublicAccessType from its string representation. - * - * @param name a name to look for. - * @return the corresponding PublicAccessType. - */ - @JsonCreator - public static PublicAccessType fromString(String name) { - return fromString(name, PublicAccessType.class); - } - - /** - * @return known PublicAccessType values. - */ - public static Collection values() { - return values(PublicAccessType.class); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/RetentionPolicy.java b/storage/client/src/main/java/com/azure/storage/blob/models/RetentionPolicy.java deleted file mode 100644 index d6285c64af18f..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/RetentionPolicy.java +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * the retention policy which determines how long the associated data should - * persist. - */ -@JacksonXmlRootElement(localName = "RetentionPolicy") -public final class RetentionPolicy { - /* - * Indicates whether a retention policy is enabled for the storage service - */ - @JsonProperty(value = "Enabled", required = true) - private boolean enabled; - - /* - * Indicates the number of days that metrics or logging or soft-deleted - * data should be retained. All data older than this value will be deleted - */ - @JsonProperty(value = "Days") - private Integer days; - - /** - * Get the enabled property: Indicates whether a retention policy is - * enabled for the storage service. - * - * @return the enabled value. - */ - public boolean enabled() { - return this.enabled; - } - - /** - * Set the enabled property: Indicates whether a retention policy is - * enabled for the storage service. - * - * @param enabled the enabled value to set. - * @return the RetentionPolicy object itself. - */ - public RetentionPolicy enabled(boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Get the days property: Indicates the number of days that metrics or - * logging or soft-deleted data should be retained. All data older than - * this value will be deleted. - * - * @return the days value. - */ - public Integer days() { - return this.days; - } - - /** - * Set the days property: Indicates the number of days that metrics or - * logging or soft-deleted data should be retained. All data older than - * this value will be deleted. - * - * @param days the days value to set. - * @return the RetentionPolicy object itself. - */ - public RetentionPolicy days(Integer days) { - this.days = days; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/SequenceNumberAccessConditions.java b/storage/client/src/main/java/com/azure/storage/blob/models/SequenceNumberAccessConditions.java deleted file mode 100644 index df0399ff59123..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/SequenceNumberAccessConditions.java +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Additional parameters for a set of operations, such as: - * PageBlobs_uploadPages, PageBlobs_clearPages, PageBlobs_uploadPagesFromURL. - */ -@JacksonXmlRootElement(localName = "sequence-number-access-conditions") -public final class SequenceNumberAccessConditions { - /* - * Specify this header value to operate only on a blob if it has a sequence - * number less than or equal to the specified. - */ - @JsonProperty(value = "ifSequenceNumberLessThanOrEqualTo") - private Long ifSequenceNumberLessThanOrEqualTo; - - /* - * Specify this header value to operate only on a blob if it has a sequence - * number less than the specified. - */ - @JsonProperty(value = "ifSequenceNumberLessThan") - private Long ifSequenceNumberLessThan; - - /* - * Specify this header value to operate only on a blob if it has the - * specified sequence number. - */ - @JsonProperty(value = "ifSequenceNumberEqualTo") - private Long ifSequenceNumberEqualTo; - - /** - * Get the ifSequenceNumberLessThanOrEqualTo property: Specify this header - * value to operate only on a blob if it has a sequence number less than or - * equal to the specified. - * - * @return the ifSequenceNumberLessThanOrEqualTo value. - */ - public Long ifSequenceNumberLessThanOrEqualTo() { - return this.ifSequenceNumberLessThanOrEqualTo; - } - - /** - * Set the ifSequenceNumberLessThanOrEqualTo property: Specify this header - * value to operate only on a blob if it has a sequence number less than or - * equal to the specified. - * - * @param ifSequenceNumberLessThanOrEqualTo the - * ifSequenceNumberLessThanOrEqualTo value to set. - * @return the SequenceNumberAccessConditions object itself. - */ - public SequenceNumberAccessConditions ifSequenceNumberLessThanOrEqualTo(Long ifSequenceNumberLessThanOrEqualTo) { - this.ifSequenceNumberLessThanOrEqualTo = ifSequenceNumberLessThanOrEqualTo; - return this; - } - - /** - * Get the ifSequenceNumberLessThan property: Specify this header value to - * operate only on a blob if it has a sequence number less than the - * specified. - * - * @return the ifSequenceNumberLessThan value. - */ - public Long ifSequenceNumberLessThan() { - return this.ifSequenceNumberLessThan; - } - - /** - * Set the ifSequenceNumberLessThan property: Specify this header value to - * operate only on a blob if it has a sequence number less than the - * specified. - * - * @param ifSequenceNumberLessThan the ifSequenceNumberLessThan value to - * set. - * @return the SequenceNumberAccessConditions object itself. - */ - public SequenceNumberAccessConditions ifSequenceNumberLessThan(Long ifSequenceNumberLessThan) { - this.ifSequenceNumberLessThan = ifSequenceNumberLessThan; - return this; - } - - /** - * Get the ifSequenceNumberEqualTo property: Specify this header value to - * operate only on a blob if it has the specified sequence number. - * - * @return the ifSequenceNumberEqualTo value. - */ - public Long ifSequenceNumberEqualTo() { - return this.ifSequenceNumberEqualTo; - } - - /** - * Set the ifSequenceNumberEqualTo property: Specify this header value to - * operate only on a blob if it has the specified sequence number. - * - * @param ifSequenceNumberEqualTo the ifSequenceNumberEqualTo value to set. - * @return the SequenceNumberAccessConditions object itself. - */ - public SequenceNumberAccessConditions ifSequenceNumberEqualTo(Long ifSequenceNumberEqualTo) { - this.ifSequenceNumberEqualTo = ifSequenceNumberEqualTo; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/SequenceNumberActionType.java b/storage/client/src/main/java/com/azure/storage/blob/models/SequenceNumberActionType.java deleted file mode 100644 index fa1bff92e415f..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/SequenceNumberActionType.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for SequenceNumberActionType. - */ -public enum SequenceNumberActionType { - /** - * Enum value max. - */ - MAX("max"), - - /** - * Enum value update. - */ - UPDATE("update"), - - /** - * Enum value increment. - */ - INCREMENT("increment"); - - /** - * The actual serialized value for a SequenceNumberActionType instance. - */ - private final String value; - - SequenceNumberActionType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a SequenceNumberActionType instance. - * - * @param value the serialized value to parse. - * @return the parsed SequenceNumberActionType object, or null if unable to parse. - */ - @JsonCreator - public static SequenceNumberActionType fromString(String value) { - SequenceNumberActionType[] items = SequenceNumberActionType.values(); - for (SequenceNumberActionType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java deleted file mode 100644 index b0c6820cf0848..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ServiceGetAccountInfoHeaders.java +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for GetAccountInfo operation. - */ -@JacksonXmlRootElement(localName = "Service-GetAccountInfo-Headers") -public final class ServiceGetAccountInfoHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * Identifies the sku name of the account. Possible values include: - * 'Standard_LRS', 'Standard_GRS', 'Standard_RAGRS', 'Standard_ZRS', - * 'Premium_LRS' - */ - @JsonProperty(value = "x-ms-sku-name") - private SkuName skuName; - - /* - * Identifies the account kind. Possible values include: 'Storage', - * 'BlobStorage', 'StorageV2' - */ - @JsonProperty(value = "x-ms-account-kind") - private AccountKind accountKind; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ServiceGetAccountInfoHeaders object itself. - */ - public ServiceGetAccountInfoHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ServiceGetAccountInfoHeaders object itself. - */ - public ServiceGetAccountInfoHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ServiceGetAccountInfoHeaders object itself. - */ - public ServiceGetAccountInfoHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the skuName property: Identifies the sku name of the account. - * Possible values include: 'Standard_LRS', 'Standard_GRS', - * 'Standard_RAGRS', 'Standard_ZRS', 'Premium_LRS'. - * - * @return the skuName value. - */ - public SkuName skuName() { - return this.skuName; - } - - /** - * Set the skuName property: Identifies the sku name of the account. - * Possible values include: 'Standard_LRS', 'Standard_GRS', - * 'Standard_RAGRS', 'Standard_ZRS', 'Premium_LRS'. - * - * @param skuName the skuName value to set. - * @return the ServiceGetAccountInfoHeaders object itself. - */ - public ServiceGetAccountInfoHeaders skuName(SkuName skuName) { - this.skuName = skuName; - return this; - } - - /** - * Get the accountKind property: Identifies the account kind. Possible - * values include: 'Storage', 'BlobStorage', 'StorageV2'. - * - * @return the accountKind value. - */ - public AccountKind accountKind() { - return this.accountKind; - } - - /** - * Set the accountKind property: Identifies the account kind. Possible - * values include: 'Storage', 'BlobStorage', 'StorageV2'. - * - * @param accountKind the accountKind value to set. - * @return the ServiceGetAccountInfoHeaders object itself. - */ - public ServiceGetAccountInfoHeaders accountKind(AccountKind accountKind) { - this.accountKind = accountKind; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ServiceGetAccountInfoHeaders object itself. - */ - public ServiceGetAccountInfoHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ServiceGetPropertiesHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ServiceGetPropertiesHeaders.java deleted file mode 100644 index 3126a5153421e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ServiceGetPropertiesHeaders.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Defines headers for GetProperties operation. - */ -@JacksonXmlRootElement(localName = "Service-GetProperties-Headers") -public final class ServiceGetPropertiesHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ServiceGetPropertiesHeaders object itself. - */ - public ServiceGetPropertiesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ServiceGetPropertiesHeaders object itself. - */ - public ServiceGetPropertiesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ServiceGetPropertiesHeaders object itself. - */ - public ServiceGetPropertiesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ServiceGetStatisticsHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ServiceGetStatisticsHeaders.java deleted file mode 100644 index 34fcda3653a60..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ServiceGetStatisticsHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for GetStatistics operation. - */ -@JacksonXmlRootElement(localName = "Service-GetStatistics-Headers") -public final class ServiceGetStatisticsHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ServiceGetStatisticsHeaders object itself. - */ - public ServiceGetStatisticsHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ServiceGetStatisticsHeaders object itself. - */ - public ServiceGetStatisticsHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ServiceGetStatisticsHeaders object itself. - */ - public ServiceGetStatisticsHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ServiceGetStatisticsHeaders object itself. - */ - public ServiceGetStatisticsHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java deleted file mode 100644 index 9c685c2906102..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ServiceGetUserDelegationKeyHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for GetUserDelegationKey operation. - */ -@JacksonXmlRootElement(localName = "Service-GetUserDelegationKey-Headers") -public final class ServiceGetUserDelegationKeyHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ServiceGetUserDelegationKeyHeaders object itself. - */ - public ServiceGetUserDelegationKeyHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ServiceGetUserDelegationKeyHeaders object itself. - */ - public ServiceGetUserDelegationKeyHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ServiceGetUserDelegationKeyHeaders object itself. - */ - public ServiceGetUserDelegationKeyHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ServiceGetUserDelegationKeyHeaders object itself. - */ - public ServiceGetUserDelegationKeyHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java deleted file mode 100644 index d22b9f1febc4f..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ServiceListContainersSegmentHeaders.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Defines headers for ListContainersSegment operation. - */ -@JacksonXmlRootElement(localName = "Service-ListContainersSegment-Headers") -public final class ServiceListContainersSegmentHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ServiceListContainersSegmentHeaders object itself. - */ - public ServiceListContainersSegmentHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ServiceListContainersSegmentHeaders object itself. - */ - public ServiceListContainersSegmentHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ServiceListContainersSegmentHeaders object itself. - */ - public ServiceListContainersSegmentHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ServiceSetPropertiesHeaders.java b/storage/client/src/main/java/com/azure/storage/blob/models/ServiceSetPropertiesHeaders.java deleted file mode 100644 index 065e595244fc3..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ServiceSetPropertiesHeaders.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Defines headers for SetProperties operation. - */ -@JacksonXmlRootElement(localName = "Service-SetProperties-Headers") -public final class ServiceSetPropertiesHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Blob service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ServiceSetPropertiesHeaders object itself. - */ - public ServiceSetPropertiesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Blob service used - * to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ServiceSetPropertiesHeaders object itself. - */ - public ServiceSetPropertiesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ServiceSetPropertiesHeaders object itself. - */ - public ServiceSetPropertiesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ServicesGetAccountInfoResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ServicesGetAccountInfoResponse.java deleted file mode 100644 index e4817e49e208a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ServicesGetAccountInfoResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getAccountInfo operation. - */ -public final class ServicesGetAccountInfoResponse extends ResponseBase { - /** - * Creates an instance of ServicesGetAccountInfoResponse. - * - * @param request the request which resulted in this ServicesGetAccountInfoResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ServicesGetAccountInfoResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ServiceGetAccountInfoHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ServicesGetPropertiesResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ServicesGetPropertiesResponse.java deleted file mode 100644 index 8ac29adaf0b79..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ServicesGetPropertiesResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getProperties operation. - */ -public final class ServicesGetPropertiesResponse extends ResponseBase { - /** - * Creates an instance of ServicesGetPropertiesResponse. - * - * @param request the request which resulted in this ServicesGetPropertiesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ServicesGetPropertiesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, StorageServiceProperties value, ServiceGetPropertiesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public StorageServiceProperties value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ServicesGetStatisticsResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ServicesGetStatisticsResponse.java deleted file mode 100644 index e99c9ad3906fb..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ServicesGetStatisticsResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getStatistics operation. - */ -public final class ServicesGetStatisticsResponse extends ResponseBase { - /** - * Creates an instance of ServicesGetStatisticsResponse. - * - * @param request the request which resulted in this ServicesGetStatisticsResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ServicesGetStatisticsResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, StorageServiceStats value, ServiceGetStatisticsHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public StorageServiceStats value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ServicesGetUserDelegationKeyResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ServicesGetUserDelegationKeyResponse.java deleted file mode 100644 index ee7db7122a4f0..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ServicesGetUserDelegationKeyResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getUserDelegationKey operation. - */ -public final class ServicesGetUserDelegationKeyResponse extends ResponseBase { - /** - * Creates an instance of ServicesGetUserDelegationKeyResponse. - * - * @param request the request which resulted in this ServicesGetUserDelegationKeyResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ServicesGetUserDelegationKeyResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, UserDelegationKey value, ServiceGetUserDelegationKeyHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public UserDelegationKey value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ServicesListContainersSegmentResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ServicesListContainersSegmentResponse.java deleted file mode 100644 index ab701d9d6139d..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ServicesListContainersSegmentResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the listContainersSegment operation. - */ -public final class ServicesListContainersSegmentResponse extends ResponseBase { - /** - * Creates an instance of ServicesListContainersSegmentResponse. - * - * @param request the request which resulted in this ServicesListContainersSegmentResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ServicesListContainersSegmentResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, ListContainersSegmentResponse value, ServiceListContainersSegmentHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public ListContainersSegmentResponse value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/ServicesSetPropertiesResponse.java b/storage/client/src/main/java/com/azure/storage/blob/models/ServicesSetPropertiesResponse.java deleted file mode 100644 index aa796b36f142a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/ServicesSetPropertiesResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the setProperties operation. - */ -public final class ServicesSetPropertiesResponse extends ResponseBase { - /** - * Creates an instance of ServicesSetPropertiesResponse. - * - * @param request the request which resulted in this ServicesSetPropertiesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ServicesSetPropertiesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ServiceSetPropertiesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/SignedIdentifier.java b/storage/client/src/main/java/com/azure/storage/blob/models/SignedIdentifier.java deleted file mode 100644 index 417f49492e51a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/SignedIdentifier.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * signed identifier. - */ -@JacksonXmlRootElement(localName = "SignedIdentifier") -public final class SignedIdentifier { - /* - * a unique id - */ - @JsonProperty(value = "Id", required = true) - private String id; - - /* - * The accessPolicy property. - */ - @JsonProperty(value = "AccessPolicy", required = true) - private AccessPolicy accessPolicy; - - /** - * Get the id property: a unique id. - * - * @return the id value. - */ - public String id() { - return this.id; - } - - /** - * Set the id property: a unique id. - * - * @param id the id value to set. - * @return the SignedIdentifier object itself. - */ - public SignedIdentifier id(String id) { - this.id = id; - return this; - } - - /** - * Get the accessPolicy property: The accessPolicy property. - * - * @return the accessPolicy value. - */ - public AccessPolicy accessPolicy() { - return this.accessPolicy; - } - - /** - * Set the accessPolicy property: The accessPolicy property. - * - * @param accessPolicy the accessPolicy value to set. - * @return the SignedIdentifier object itself. - */ - public SignedIdentifier accessPolicy(AccessPolicy accessPolicy) { - this.accessPolicy = accessPolicy; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/SkuName.java b/storage/client/src/main/java/com/azure/storage/blob/models/SkuName.java deleted file mode 100644 index 30cfa3997e5e0..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/SkuName.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for SkuName. - */ -public enum SkuName { - /** - * Enum value Standard_LRS. - */ - STANDARD_LRS("Standard_LRS"), - - /** - * Enum value Standard_GRS. - */ - STANDARD_GRS("Standard_GRS"), - - /** - * Enum value Standard_RAGRS. - */ - STANDARD_RAGRS("Standard_RAGRS"), - - /** - * Enum value Standard_ZRS. - */ - STANDARD_ZRS("Standard_ZRS"), - - /** - * Enum value Premium_LRS. - */ - PREMIUM_LRS("Premium_LRS"); - - /** - * The actual serialized value for a SkuName instance. - */ - private final String value; - - SkuName(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a SkuName instance. - * - * @param value the serialized value to parse. - * @return the parsed SkuName object, or null if unable to parse. - */ - @JsonCreator - public static SkuName fromString(String value) { - SkuName[] items = SkuName.values(); - for (SkuName item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/SourceModifiedAccessConditions.java b/storage/client/src/main/java/com/azure/storage/blob/models/SourceModifiedAccessConditions.java deleted file mode 100644 index 84b179bb01812..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/SourceModifiedAccessConditions.java +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Additional parameters for a set of operations. - */ -@JacksonXmlRootElement(localName = "source-modified-access-conditions") -public final class SourceModifiedAccessConditions { - /* - * Specify this header value to operate only on a blob if it has been - * modified since the specified date/time. - */ - @JsonProperty(value = "sourceIfModifiedSince") - private DateTimeRfc1123 sourceIfModifiedSince; - - /* - * Specify this header value to operate only on a blob if it has not been - * modified since the specified date/time. - */ - @JsonProperty(value = "sourceIfUnmodifiedSince") - private DateTimeRfc1123 sourceIfUnmodifiedSince; - - /* - * Specify an ETag value to operate only on blobs with a matching value. - */ - @JsonProperty(value = "sourceIfMatch") - private String sourceIfMatch; - - /* - * Specify an ETag value to operate only on blobs without a matching value. - */ - @JsonProperty(value = "sourceIfNoneMatch") - private String sourceIfNoneMatch; - - /** - * Get the sourceIfModifiedSince property: Specify this header value to - * operate only on a blob if it has been modified since the specified - * date/time. - * - * @return the sourceIfModifiedSince value. - */ - public OffsetDateTime sourceIfModifiedSince() { - if (this.sourceIfModifiedSince == null) { - return null; - } - return this.sourceIfModifiedSince.dateTime(); - } - - /** - * Set the sourceIfModifiedSince property: Specify this header value to - * operate only on a blob if it has been modified since the specified - * date/time. - * - * @param sourceIfModifiedSince the sourceIfModifiedSince value to set. - * @return the SourceModifiedAccessConditions object itself. - */ - public SourceModifiedAccessConditions sourceIfModifiedSince(OffsetDateTime sourceIfModifiedSince) { - if (sourceIfModifiedSince == null) { - this.sourceIfModifiedSince = null; - } else { - this.sourceIfModifiedSince = new DateTimeRfc1123(sourceIfModifiedSince); - } - return this; - } - - /** - * Get the sourceIfUnmodifiedSince property: Specify this header value to - * operate only on a blob if it has not been modified since the specified - * date/time. - * - * @return the sourceIfUnmodifiedSince value. - */ - public OffsetDateTime sourceIfUnmodifiedSince() { - if (this.sourceIfUnmodifiedSince == null) { - return null; - } - return this.sourceIfUnmodifiedSince.dateTime(); - } - - /** - * Set the sourceIfUnmodifiedSince property: Specify this header value to - * operate only on a blob if it has not been modified since the specified - * date/time. - * - * @param sourceIfUnmodifiedSince the sourceIfUnmodifiedSince value to set. - * @return the SourceModifiedAccessConditions object itself. - */ - public SourceModifiedAccessConditions sourceIfUnmodifiedSince(OffsetDateTime sourceIfUnmodifiedSince) { - if (sourceIfUnmodifiedSince == null) { - this.sourceIfUnmodifiedSince = null; - } else { - this.sourceIfUnmodifiedSince = new DateTimeRfc1123(sourceIfUnmodifiedSince); - } - return this; - } - - /** - * Get the sourceIfMatch property: Specify an ETag value to operate only on - * blobs with a matching value. - * - * @return the sourceIfMatch value. - */ - public String sourceIfMatch() { - return this.sourceIfMatch; - } - - /** - * Set the sourceIfMatch property: Specify an ETag value to operate only on - * blobs with a matching value. - * - * @param sourceIfMatch the sourceIfMatch value to set. - * @return the SourceModifiedAccessConditions object itself. - */ - public SourceModifiedAccessConditions sourceIfMatch(String sourceIfMatch) { - this.sourceIfMatch = sourceIfMatch; - return this; - } - - /** - * Get the sourceIfNoneMatch property: Specify an ETag value to operate - * only on blobs without a matching value. - * - * @return the sourceIfNoneMatch value. - */ - public String sourceIfNoneMatch() { - return this.sourceIfNoneMatch; - } - - /** - * Set the sourceIfNoneMatch property: Specify an ETag value to operate - * only on blobs without a matching value. - * - * @param sourceIfNoneMatch the sourceIfNoneMatch value to set. - * @return the SourceModifiedAccessConditions object itself. - */ - public SourceModifiedAccessConditions sourceIfNoneMatch(String sourceIfNoneMatch) { - this.sourceIfNoneMatch = sourceIfNoneMatch; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/StaticWebsite.java b/storage/client/src/main/java/com/azure/storage/blob/models/StaticWebsite.java deleted file mode 100644 index 45971febb06e2..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/StaticWebsite.java +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * The properties that enable an account to host a static website. - */ -@JacksonXmlRootElement(localName = "StaticWebsite") -public final class StaticWebsite { - /* - * Indicates whether this account is hosting a static website - */ - @JsonProperty(value = "Enabled", required = true) - private boolean enabled; - - /* - * The default name of the index page under each directory - */ - @JsonProperty(value = "IndexDocument") - private String indexDocument; - - /* - * The absolute path of the custom 404 page - */ - @JsonProperty(value = "ErrorDocument404Path") - private String errorDocument404Path; - - /** - * Get the enabled property: Indicates whether this account is hosting a - * static website. - * - * @return the enabled value. - */ - public boolean enabled() { - return this.enabled; - } - - /** - * Set the enabled property: Indicates whether this account is hosting a - * static website. - * - * @param enabled the enabled value to set. - * @return the StaticWebsite object itself. - */ - public StaticWebsite enabled(boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Get the indexDocument property: The default name of the index page under - * each directory. - * - * @return the indexDocument value. - */ - public String indexDocument() { - return this.indexDocument; - } - - /** - * Set the indexDocument property: The default name of the index page under - * each directory. - * - * @param indexDocument the indexDocument value to set. - * @return the StaticWebsite object itself. - */ - public StaticWebsite indexDocument(String indexDocument) { - this.indexDocument = indexDocument; - return this; - } - - /** - * Get the errorDocument404Path property: The absolute path of the custom - * 404 page. - * - * @return the errorDocument404Path value. - */ - public String errorDocument404Path() { - return this.errorDocument404Path; - } - - /** - * Set the errorDocument404Path property: The absolute path of the custom - * 404 page. - * - * @param errorDocument404Path the errorDocument404Path value to set. - * @return the StaticWebsite object itself. - */ - public StaticWebsite errorDocument404Path(String errorDocument404Path) { - this.errorDocument404Path = errorDocument404Path; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/StorageError.java b/storage/client/src/main/java/com/azure/storage/blob/models/StorageError.java deleted file mode 100644 index 55c96be21c801..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/StorageError.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * The StorageError model. - */ -@JacksonXmlRootElement(localName = "StorageError") -public final class StorageError { - /* - * The code property. - */ - @JsonProperty(value = "Code") - private String code; - - /* - * The message property. - */ - @JsonProperty(value = "Message") - private String message; - - /** - * Get the code property: The code property. - * - * @return the code value. - */ - public String code() { - return this.code; - } - - /** - * Set the code property: The code property. - * - * @param code the code value to set. - * @return the StorageError object itself. - */ - public StorageError code(String code) { - this.code = code; - return this; - } - - /** - * Get the message property: The message property. - * - * @return the message value. - */ - public String message() { - return this.message; - } - - /** - * Set the message property: The message property. - * - * @param message the message value to set. - * @return the StorageError object itself. - */ - public StorageError message(String message) { - this.message = message; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/StorageErrorCode.java b/storage/client/src/main/java/com/azure/storage/blob/models/StorageErrorCode.java deleted file mode 100644 index 5ef1a7209deec..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/StorageErrorCode.java +++ /dev/null @@ -1,557 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** - * Defines values for StorageErrorCode. - */ -public final class StorageErrorCode extends ExpandableStringEnum { - /** - * Static value AccountAlreadyExists for StorageErrorCode. - */ - public static final StorageErrorCode ACCOUNT_ALREADY_EXISTS = fromString("AccountAlreadyExists"); - - /** - * Static value AccountBeingCreated for StorageErrorCode. - */ - public static final StorageErrorCode ACCOUNT_BEING_CREATED = fromString("AccountBeingCreated"); - - /** - * Static value AccountIsDisabled for StorageErrorCode. - */ - public static final StorageErrorCode ACCOUNT_IS_DISABLED = fromString("AccountIsDisabled"); - - /** - * Static value AuthenticationFailed for StorageErrorCode. - */ - public static final StorageErrorCode AUTHENTICATION_FAILED = fromString("AuthenticationFailed"); - - /** - * Static value AuthorizationFailure for StorageErrorCode. - */ - public static final StorageErrorCode AUTHORIZATION_FAILURE = fromString("AuthorizationFailure"); - - /** - * Static value ConditionHeadersNotSupported for StorageErrorCode. - */ - public static final StorageErrorCode CONDITION_HEADERS_NOT_SUPPORTED = fromString("ConditionHeadersNotSupported"); - - /** - * Static value ConditionNotMet for StorageErrorCode. - */ - public static final StorageErrorCode CONDITION_NOT_MET = fromString("ConditionNotMet"); - - /** - * Static value EmptyMetadataKey for StorageErrorCode. - */ - public static final StorageErrorCode EMPTY_METADATA_KEY = fromString("EmptyMetadataKey"); - - /** - * Static value InsufficientAccountPermissions for StorageErrorCode. - */ - public static final StorageErrorCode INSUFFICIENT_ACCOUNT_PERMISSIONS = fromString("InsufficientAccountPermissions"); - - /** - * Static value InternalError for StorageErrorCode. - */ - public static final StorageErrorCode INTERNAL_ERROR = fromString("InternalError"); - - /** - * Static value InvalidAuthenticationInfo for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_AUTHENTICATION_INFO = fromString("InvalidAuthenticationInfo"); - - /** - * Static value InvalidHeaderValue for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_HEADER_VALUE = fromString("InvalidHeaderValue"); - - /** - * Static value InvalidHttpVerb for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_HTTP_VERB = fromString("InvalidHttpVerb"); - - /** - * Static value InvalidInput for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_INPUT = fromString("InvalidInput"); - - /** - * Static value InvalidMd5 for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_MD5 = fromString("InvalidMd5"); - - /** - * Static value InvalidMetadata for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_METADATA = fromString("InvalidMetadata"); - - /** - * Static value InvalidQueryParameterValue for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_QUERY_PARAMETER_VALUE = fromString("InvalidQueryParameterValue"); - - /** - * Static value InvalidRange for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_RANGE = fromString("InvalidRange"); - - /** - * Static value InvalidResourceName for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_RESOURCE_NAME = fromString("InvalidResourceName"); - - /** - * Static value InvalidUri for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_URI = fromString("InvalidUri"); - - /** - * Static value InvalidXmlDocument for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_XML_DOCUMENT = fromString("InvalidXmlDocument"); - - /** - * Static value InvalidXmlNodeValue for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_XML_NODE_VALUE = fromString("InvalidXmlNodeValue"); - - /** - * Static value Md5Mismatch for StorageErrorCode. - */ - public static final StorageErrorCode MD5MISMATCH = fromString("Md5Mismatch"); - - /** - * Static value MetadataTooLarge for StorageErrorCode. - */ - public static final StorageErrorCode METADATA_TOO_LARGE = fromString("MetadataTooLarge"); - - /** - * Static value MissingContentLengthHeader for StorageErrorCode. - */ - public static final StorageErrorCode MISSING_CONTENT_LENGTH_HEADER = fromString("MissingContentLengthHeader"); - - /** - * Static value MissingRequiredQueryParameter for StorageErrorCode. - */ - public static final StorageErrorCode MISSING_REQUIRED_QUERY_PARAMETER = fromString("MissingRequiredQueryParameter"); - - /** - * Static value MissingRequiredHeader for StorageErrorCode. - */ - public static final StorageErrorCode MISSING_REQUIRED_HEADER = fromString("MissingRequiredHeader"); - - /** - * Static value MissingRequiredXmlNode for StorageErrorCode. - */ - public static final StorageErrorCode MISSING_REQUIRED_XML_NODE = fromString("MissingRequiredXmlNode"); - - /** - * Static value MultipleConditionHeadersNotSupported for StorageErrorCode. - */ - public static final StorageErrorCode MULTIPLE_CONDITION_HEADERS_NOT_SUPPORTED = fromString("MultipleConditionHeadersNotSupported"); - - /** - * Static value OperationTimedOut for StorageErrorCode. - */ - public static final StorageErrorCode OPERATION_TIMED_OUT = fromString("OperationTimedOut"); - - /** - * Static value OutOfRangeInput for StorageErrorCode. - */ - public static final StorageErrorCode OUT_OF_RANGE_INPUT = fromString("OutOfRangeInput"); - - /** - * Static value OutOfRangeQueryParameterValue for StorageErrorCode. - */ - public static final StorageErrorCode OUT_OF_RANGE_QUERY_PARAMETER_VALUE = fromString("OutOfRangeQueryParameterValue"); - - /** - * Static value RequestBodyTooLarge for StorageErrorCode. - */ - public static final StorageErrorCode REQUEST_BODY_TOO_LARGE = fromString("RequestBodyTooLarge"); - - /** - * Static value ResourceTypeMismatch for StorageErrorCode. - */ - public static final StorageErrorCode RESOURCE_TYPE_MISMATCH = fromString("ResourceTypeMismatch"); - - /** - * Static value RequestUrlFailedToParse for StorageErrorCode. - */ - public static final StorageErrorCode REQUEST_URL_FAILED_TO_PARSE = fromString("RequestUrlFailedToParse"); - - /** - * Static value ResourceAlreadyExists for StorageErrorCode. - */ - public static final StorageErrorCode RESOURCE_ALREADY_EXISTS = fromString("ResourceAlreadyExists"); - - /** - * Static value ResourceNotFound for StorageErrorCode. - */ - public static final StorageErrorCode RESOURCE_NOT_FOUND = fromString("ResourceNotFound"); - - /** - * Static value ServerBusy for StorageErrorCode. - */ - public static final StorageErrorCode SERVER_BUSY = fromString("ServerBusy"); - - /** - * Static value UnsupportedHeader for StorageErrorCode. - */ - public static final StorageErrorCode UNSUPPORTED_HEADER = fromString("UnsupportedHeader"); - - /** - * Static value UnsupportedXmlNode for StorageErrorCode. - */ - public static final StorageErrorCode UNSUPPORTED_XML_NODE = fromString("UnsupportedXmlNode"); - - /** - * Static value UnsupportedQueryParameter for StorageErrorCode. - */ - public static final StorageErrorCode UNSUPPORTED_QUERY_PARAMETER = fromString("UnsupportedQueryParameter"); - - /** - * Static value UnsupportedHttpVerb for StorageErrorCode. - */ - public static final StorageErrorCode UNSUPPORTED_HTTP_VERB = fromString("UnsupportedHttpVerb"); - - /** - * Static value AppendPositionConditionNotMet for StorageErrorCode. - */ - public static final StorageErrorCode APPEND_POSITION_CONDITION_NOT_MET = fromString("AppendPositionConditionNotMet"); - - /** - * Static value BlobAlreadyExists for StorageErrorCode. - */ - public static final StorageErrorCode BLOB_ALREADY_EXISTS = fromString("BlobAlreadyExists"); - - /** - * Static value BlobNotFound for StorageErrorCode. - */ - public static final StorageErrorCode BLOB_NOT_FOUND = fromString("BlobNotFound"); - - /** - * Static value BlobOverwritten for StorageErrorCode. - */ - public static final StorageErrorCode BLOB_OVERWRITTEN = fromString("BlobOverwritten"); - - /** - * Static value BlobTierInadequateForContentLength for StorageErrorCode. - */ - public static final StorageErrorCode BLOB_TIER_INADEQUATE_FOR_CONTENT_LENGTH = fromString("BlobTierInadequateForContentLength"); - - /** - * Static value BlockCountExceedsLimit for StorageErrorCode. - */ - public static final StorageErrorCode BLOCK_COUNT_EXCEEDS_LIMIT = fromString("BlockCountExceedsLimit"); - - /** - * Static value BlockListTooLong for StorageErrorCode. - */ - public static final StorageErrorCode BLOCK_LIST_TOO_LONG = fromString("BlockListTooLong"); - - /** - * Static value CannotChangeToLowerTier for StorageErrorCode. - */ - public static final StorageErrorCode CANNOT_CHANGE_TO_LOWER_TIER = fromString("CannotChangeToLowerTier"); - - /** - * Static value CannotVerifyCopySource for StorageErrorCode. - */ - public static final StorageErrorCode CANNOT_VERIFY_COPY_SOURCE = fromString("CannotVerifyCopySource"); - - /** - * Static value ContainerAlreadyExists for StorageErrorCode. - */ - public static final StorageErrorCode CONTAINER_ALREADY_EXISTS = fromString("ContainerAlreadyExists"); - - /** - * Static value ContainerBeingDeleted for StorageErrorCode. - */ - public static final StorageErrorCode CONTAINER_BEING_DELETED = fromString("ContainerBeingDeleted"); - - /** - * Static value ContainerDisabled for StorageErrorCode. - */ - public static final StorageErrorCode CONTAINER_DISABLED = fromString("ContainerDisabled"); - - /** - * Static value ContainerNotFound for StorageErrorCode. - */ - public static final StorageErrorCode CONTAINER_NOT_FOUND = fromString("ContainerNotFound"); - - /** - * Static value ContentLengthLargerThanTierLimit for StorageErrorCode. - */ - public static final StorageErrorCode CONTENT_LENGTH_LARGER_THAN_TIER_LIMIT = fromString("ContentLengthLargerThanTierLimit"); - - /** - * Static value CopyAcrossAccountsNotSupported for StorageErrorCode. - */ - public static final StorageErrorCode COPY_ACROSS_ACCOUNTS_NOT_SUPPORTED = fromString("CopyAcrossAccountsNotSupported"); - - /** - * Static value CopyIdMismatch for StorageErrorCode. - */ - public static final StorageErrorCode COPY_ID_MISMATCH = fromString("CopyIdMismatch"); - - /** - * Static value FeatureVersionMismatch for StorageErrorCode. - */ - public static final StorageErrorCode FEATURE_VERSION_MISMATCH = fromString("FeatureVersionMismatch"); - - /** - * Static value IncrementalCopyBlobMismatch for StorageErrorCode. - */ - public static final StorageErrorCode INCREMENTAL_COPY_BLOB_MISMATCH = fromString("IncrementalCopyBlobMismatch"); - - /** - * Static value IncrementalCopyOfEralierVersionSnapshotNotAllowed for StorageErrorCode. - */ - public static final StorageErrorCode INCREMENTAL_COPY_OF_ERALIER_VERSION_SNAPSHOT_NOT_ALLOWED = fromString("IncrementalCopyOfEralierVersionSnapshotNotAllowed"); - - /** - * Static value IncrementalCopySourceMustBeSnapshot for StorageErrorCode. - */ - public static final StorageErrorCode INCREMENTAL_COPY_SOURCE_MUST_BE_SNAPSHOT = fromString("IncrementalCopySourceMustBeSnapshot"); - - /** - * Static value InfiniteLeaseDurationRequired for StorageErrorCode. - */ - public static final StorageErrorCode INFINITE_LEASE_DURATION_REQUIRED = fromString("InfiniteLeaseDurationRequired"); - - /** - * Static value InvalidBlobOrBlock for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_BLOB_OR_BLOCK = fromString("InvalidBlobOrBlock"); - - /** - * Static value InvalidBlobTier for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_BLOB_TIER = fromString("InvalidBlobTier"); - - /** - * Static value InvalidBlobType for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_BLOB_TYPE = fromString("InvalidBlobType"); - - /** - * Static value InvalidBlockId for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_BLOCK_ID = fromString("InvalidBlockId"); - - /** - * Static value InvalidBlockList for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_BLOCK_LIST = fromString("InvalidBlockList"); - - /** - * Static value InvalidOperation for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_OPERATION = fromString("InvalidOperation"); - - /** - * Static value InvalidPageRange for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_PAGE_RANGE = fromString("InvalidPageRange"); - - /** - * Static value InvalidSourceBlobType for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_SOURCE_BLOB_TYPE = fromString("InvalidSourceBlobType"); - - /** - * Static value InvalidSourceBlobUrl for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_SOURCE_BLOB_URL = fromString("InvalidSourceBlobUrl"); - - /** - * Static value InvalidVersionForPageBlobOperation for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_VERSION_FOR_PAGE_BLOB_OPERATION = fromString("InvalidVersionForPageBlobOperation"); - - /** - * Static value LeaseAlreadyPresent for StorageErrorCode. - */ - public static final StorageErrorCode LEASE_ALREADY_PRESENT = fromString("LeaseAlreadyPresent"); - - /** - * Static value LeaseAlreadyBroken for StorageErrorCode. - */ - public static final StorageErrorCode LEASE_ALREADY_BROKEN = fromString("LeaseAlreadyBroken"); - - /** - * Static value LeaseIdMismatchWithBlobOperation for StorageErrorCode. - */ - public static final StorageErrorCode LEASE_ID_MISMATCH_WITH_BLOB_OPERATION = fromString("LeaseIdMismatchWithBlobOperation"); - - /** - * Static value LeaseIdMismatchWithContainerOperation for StorageErrorCode. - */ - public static final StorageErrorCode LEASE_ID_MISMATCH_WITH_CONTAINER_OPERATION = fromString("LeaseIdMismatchWithContainerOperation"); - - /** - * Static value LeaseIdMismatchWithLeaseOperation for StorageErrorCode. - */ - public static final StorageErrorCode LEASE_ID_MISMATCH_WITH_LEASE_OPERATION = fromString("LeaseIdMismatchWithLeaseOperation"); - - /** - * Static value LeaseIdMissing for StorageErrorCode. - */ - public static final StorageErrorCode LEASE_ID_MISSING = fromString("LeaseIdMissing"); - - /** - * Static value LeaseIsBreakingAndCannotBeAcquired for StorageErrorCode. - */ - public static final StorageErrorCode LEASE_IS_BREAKING_AND_CANNOT_BE_ACQUIRED = fromString("LeaseIsBreakingAndCannotBeAcquired"); - - /** - * Static value LeaseIsBreakingAndCannotBeChanged for StorageErrorCode. - */ - public static final StorageErrorCode LEASE_IS_BREAKING_AND_CANNOT_BE_CHANGED = fromString("LeaseIsBreakingAndCannotBeChanged"); - - /** - * Static value LeaseIsBrokenAndCannotBeRenewed for StorageErrorCode. - */ - public static final StorageErrorCode LEASE_IS_BROKEN_AND_CANNOT_BE_RENEWED = fromString("LeaseIsBrokenAndCannotBeRenewed"); - - /** - * Static value LeaseLost for StorageErrorCode. - */ - public static final StorageErrorCode LEASE_LOST = fromString("LeaseLost"); - - /** - * Static value LeaseNotPresentWithBlobOperation for StorageErrorCode. - */ - public static final StorageErrorCode LEASE_NOT_PRESENT_WITH_BLOB_OPERATION = fromString("LeaseNotPresentWithBlobOperation"); - - /** - * Static value LeaseNotPresentWithContainerOperation for StorageErrorCode. - */ - public static final StorageErrorCode LEASE_NOT_PRESENT_WITH_CONTAINER_OPERATION = fromString("LeaseNotPresentWithContainerOperation"); - - /** - * Static value LeaseNotPresentWithLeaseOperation for StorageErrorCode. - */ - public static final StorageErrorCode LEASE_NOT_PRESENT_WITH_LEASE_OPERATION = fromString("LeaseNotPresentWithLeaseOperation"); - - /** - * Static value MaxBlobSizeConditionNotMet for StorageErrorCode. - */ - public static final StorageErrorCode MAX_BLOB_SIZE_CONDITION_NOT_MET = fromString("MaxBlobSizeConditionNotMet"); - - /** - * Static value NoPendingCopyOperation for StorageErrorCode. - */ - public static final StorageErrorCode NO_PENDING_COPY_OPERATION = fromString("NoPendingCopyOperation"); - - /** - * Static value OperationNotAllowedOnIncrementalCopyBlob for StorageErrorCode. - */ - public static final StorageErrorCode OPERATION_NOT_ALLOWED_ON_INCREMENTAL_COPY_BLOB = fromString("OperationNotAllowedOnIncrementalCopyBlob"); - - /** - * Static value PendingCopyOperation for StorageErrorCode. - */ - public static final StorageErrorCode PENDING_COPY_OPERATION = fromString("PendingCopyOperation"); - - /** - * Static value PreviousSnapshotCannotBeNewer for StorageErrorCode. - */ - public static final StorageErrorCode PREVIOUS_SNAPSHOT_CANNOT_BE_NEWER = fromString("PreviousSnapshotCannotBeNewer"); - - /** - * Static value PreviousSnapshotNotFound for StorageErrorCode. - */ - public static final StorageErrorCode PREVIOUS_SNAPSHOT_NOT_FOUND = fromString("PreviousSnapshotNotFound"); - - /** - * Static value PreviousSnapshotOperationNotSupported for StorageErrorCode. - */ - public static final StorageErrorCode PREVIOUS_SNAPSHOT_OPERATION_NOT_SUPPORTED = fromString("PreviousSnapshotOperationNotSupported"); - - /** - * Static value SequenceNumberConditionNotMet for StorageErrorCode. - */ - public static final StorageErrorCode SEQUENCE_NUMBER_CONDITION_NOT_MET = fromString("SequenceNumberConditionNotMet"); - - /** - * Static value SequenceNumberIncrementTooLarge for StorageErrorCode. - */ - public static final StorageErrorCode SEQUENCE_NUMBER_INCREMENT_TOO_LARGE = fromString("SequenceNumberIncrementTooLarge"); - - /** - * Static value SnapshotCountExceeded for StorageErrorCode. - */ - public static final StorageErrorCode SNAPSHOT_COUNT_EXCEEDED = fromString("SnapshotCountExceeded"); - - /** - * Static value SnaphotOperationRateExceeded for StorageErrorCode. - */ - public static final StorageErrorCode SNAPHOT_OPERATION_RATE_EXCEEDED = fromString("SnaphotOperationRateExceeded"); - - /** - * Static value SnapshotsPresent for StorageErrorCode. - */ - public static final StorageErrorCode SNAPSHOTS_PRESENT = fromString("SnapshotsPresent"); - - /** - * Static value SourceConditionNotMet for StorageErrorCode. - */ - public static final StorageErrorCode SOURCE_CONDITION_NOT_MET = fromString("SourceConditionNotMet"); - - /** - * Static value SystemInUse for StorageErrorCode. - */ - public static final StorageErrorCode SYSTEM_IN_USE = fromString("SystemInUse"); - - /** - * Static value TargetConditionNotMet for StorageErrorCode. - */ - public static final StorageErrorCode TARGET_CONDITION_NOT_MET = fromString("TargetConditionNotMet"); - - /** - * Static value UnauthorizedBlobOverwrite for StorageErrorCode. - */ - public static final StorageErrorCode UNAUTHORIZED_BLOB_OVERWRITE = fromString("UnauthorizedBlobOverwrite"); - - /** - * Static value BlobBeingRehydrated for StorageErrorCode. - */ - public static final StorageErrorCode BLOB_BEING_REHYDRATED = fromString("BlobBeingRehydrated"); - - /** - * Static value BlobArchived for StorageErrorCode. - */ - public static final StorageErrorCode BLOB_ARCHIVED = fromString("BlobArchived"); - - /** - * Static value BlobNotArchived for StorageErrorCode. - */ - public static final StorageErrorCode BLOB_NOT_ARCHIVED = fromString("BlobNotArchived"); - - /** - * Creates or finds a StorageErrorCode from its string representation. - * - * @param name a name to look for. - * @return the corresponding StorageErrorCode. - */ - @JsonCreator - public static StorageErrorCode fromString(String name) { - return fromString(name, StorageErrorCode.class); - } - - /** - * @return known StorageErrorCode values. - */ - public static Collection values() { - return values(StorageErrorCode.class); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/StorageErrorException.java b/storage/client/src/main/java/com/azure/storage/blob/models/StorageErrorException.java deleted file mode 100644 index 11303394c211e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/StorageErrorException.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.HttpResponse; - -/** - * Exception thrown for an invalid response with StorageError information. - */ -public final class StorageErrorException extends HttpResponseException { - /** - * Initializes a new instance of the StorageErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - */ - public StorageErrorException(String message, HttpResponse response) { - super(message, response); - } - - /** - * Initializes a new instance of the StorageErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - * @param value the deserialized response value. - */ - public StorageErrorException(String message, HttpResponse response, StorageError value) { - super(message, response, value); - } - - @Override - public StorageError value() { - return (StorageError) super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java b/storage/client/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java deleted file mode 100644 index 79e072ba2b059..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/StorageServiceProperties.java +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.ArrayList; -import java.util.List; - -/** - * Storage Service Properties. - */ -@JacksonXmlRootElement(localName = "StorageServiceProperties") -public final class StorageServiceProperties { - /* - * The logging property. - */ - @JsonProperty(value = "Logging") - private Logging logging; - - /* - * The hourMetrics property. - */ - @JsonProperty(value = "HourMetrics") - private Metrics hourMetrics; - - /* - * The minuteMetrics property. - */ - @JsonProperty(value = "MinuteMetrics") - private Metrics minuteMetrics; - - private static final class CorsWrapper { - @JacksonXmlProperty(localName = "CorsRule") - private final List items; - - @JsonCreator - private CorsWrapper(@JacksonXmlProperty(localName = "CorsRule") List items) { - this.items = items; - } - } - - /* - * The set of CORS rules. - */ - @JsonProperty(value = "Cors") - private CorsWrapper cors; - - /* - * The default version to use for requests to the Blob service if an - * incoming request's version is not specified. Possible values include - * version 2008-10-27 and all more recent versions - */ - @JsonProperty(value = "DefaultServiceVersion") - private String defaultServiceVersion; - - /* - * The deleteRetentionPolicy property. - */ - @JsonProperty(value = "DeleteRetentionPolicy") - private RetentionPolicy deleteRetentionPolicy; - - /* - * The staticWebsite property. - */ - @JsonProperty(value = "StaticWebsite") - private StaticWebsite staticWebsite; - - /** - * Get the logging property: The logging property. - * - * @return the logging value. - */ - public Logging logging() { - return this.logging; - } - - /** - * Set the logging property: The logging property. - * - * @param logging the logging value to set. - * @return the StorageServiceProperties object itself. - */ - public StorageServiceProperties logging(Logging logging) { - this.logging = logging; - return this; - } - - /** - * Get the hourMetrics property: The hourMetrics property. - * - * @return the hourMetrics value. - */ - public Metrics hourMetrics() { - return this.hourMetrics; - } - - /** - * Set the hourMetrics property: The hourMetrics property. - * - * @param hourMetrics the hourMetrics value to set. - * @return the StorageServiceProperties object itself. - */ - public StorageServiceProperties hourMetrics(Metrics hourMetrics) { - this.hourMetrics = hourMetrics; - return this; - } - - /** - * Get the minuteMetrics property: The minuteMetrics property. - * - * @return the minuteMetrics value. - */ - public Metrics minuteMetrics() { - return this.minuteMetrics; - } - - /** - * Set the minuteMetrics property: The minuteMetrics property. - * - * @param minuteMetrics the minuteMetrics value to set. - * @return the StorageServiceProperties object itself. - */ - public StorageServiceProperties minuteMetrics(Metrics minuteMetrics) { - this.minuteMetrics = minuteMetrics; - return this; - } - - /** - * Get the cors property: The set of CORS rules. - * - * @return the cors value. - */ - public List cors() { - if (this.cors == null) { - this.cors = new CorsWrapper(new ArrayList()); - } - return this.cors.items; - } - - /** - * Set the cors property: The set of CORS rules. - * - * @param cors the cors value to set. - * @return the StorageServiceProperties object itself. - */ - public StorageServiceProperties cors(List cors) { - this.cors = new CorsWrapper(cors); - return this; - } - - /** - * Get the defaultServiceVersion property: The default version to use for - * requests to the Blob service if an incoming request's version is not - * specified. Possible values include version 2008-10-27 and all more - * recent versions. - * - * @return the defaultServiceVersion value. - */ - public String defaultServiceVersion() { - return this.defaultServiceVersion; - } - - /** - * Set the defaultServiceVersion property: The default version to use for - * requests to the Blob service if an incoming request's version is not - * specified. Possible values include version 2008-10-27 and all more - * recent versions. - * - * @param defaultServiceVersion the defaultServiceVersion value to set. - * @return the StorageServiceProperties object itself. - */ - public StorageServiceProperties defaultServiceVersion(String defaultServiceVersion) { - this.defaultServiceVersion = defaultServiceVersion; - return this; - } - - /** - * Get the deleteRetentionPolicy property: The deleteRetentionPolicy - * property. - * - * @return the deleteRetentionPolicy value. - */ - public RetentionPolicy deleteRetentionPolicy() { - return this.deleteRetentionPolicy; - } - - /** - * Set the deleteRetentionPolicy property: The deleteRetentionPolicy - * property. - * - * @param deleteRetentionPolicy the deleteRetentionPolicy value to set. - * @return the StorageServiceProperties object itself. - */ - public StorageServiceProperties deleteRetentionPolicy(RetentionPolicy deleteRetentionPolicy) { - this.deleteRetentionPolicy = deleteRetentionPolicy; - return this; - } - - /** - * Get the staticWebsite property: The staticWebsite property. - * - * @return the staticWebsite value. - */ - public StaticWebsite staticWebsite() { - return this.staticWebsite; - } - - /** - * Set the staticWebsite property: The staticWebsite property. - * - * @param staticWebsite the staticWebsite value to set. - * @return the StorageServiceProperties object itself. - */ - public StorageServiceProperties staticWebsite(StaticWebsite staticWebsite) { - this.staticWebsite = staticWebsite; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/StorageServiceStats.java b/storage/client/src/main/java/com/azure/storage/blob/models/StorageServiceStats.java deleted file mode 100644 index 5eb67c3230645..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/StorageServiceStats.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Stats for the storage service. - */ -@JacksonXmlRootElement(localName = "StorageServiceStats") -public final class StorageServiceStats { - /* - * The geoReplication property. - */ - @JsonProperty(value = "GeoReplication") - private GeoReplication geoReplication; - - /** - * Get the geoReplication property: The geoReplication property. - * - * @return the geoReplication value. - */ - public GeoReplication geoReplication() { - return this.geoReplication; - } - - /** - * Set the geoReplication property: The geoReplication property. - * - * @param geoReplication the geoReplication value to set. - * @return the StorageServiceStats object itself. - */ - public StorageServiceStats geoReplication(GeoReplication geoReplication) { - this.geoReplication = geoReplication; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/SyncCopyStatusType.java b/storage/client/src/main/java/com/azure/storage/blob/models/SyncCopyStatusType.java deleted file mode 100644 index 74f8890fcb3b2..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/SyncCopyStatusType.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for SyncCopyStatusType. - */ -public enum SyncCopyStatusType { - /** - * Enum value success. - */ - SUCCESS("success"); - - /** - * The actual serialized value for a SyncCopyStatusType instance. - */ - private final String value; - - SyncCopyStatusType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a SyncCopyStatusType instance. - * - * @param value the serialized value to parse. - * @return the parsed SyncCopyStatusType object, or null if unable to parse. - */ - @JsonCreator - public static SyncCopyStatusType fromString(String value) { - SyncCopyStatusType[] items = SyncCopyStatusType.values(); - for (SyncCopyStatusType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/UserDelegationKey.java b/storage/client/src/main/java/com/azure/storage/blob/models/UserDelegationKey.java deleted file mode 100644 index d267df92d7c29..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/UserDelegationKey.java +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * A user delegation key. - */ -@JacksonXmlRootElement(localName = "UserDelegationKey") -public final class UserDelegationKey { - /* - * The Azure Active Directory object ID in GUID format. - */ - @JsonProperty(value = "SignedOid", required = true) - private String signedOid; - - /* - * The Azure Active Directory tenant ID in GUID format - */ - @JsonProperty(value = "SignedTid", required = true) - private String signedTid; - - /* - * The date-time the key is active - */ - @JsonProperty(value = "SignedStart", required = true) - private OffsetDateTime signedStart; - - /* - * The date-time the key expires - */ - @JsonProperty(value = "SignedExpiry", required = true) - private OffsetDateTime signedExpiry; - - /* - * Abbreviation of the Azure Storage service that accepts the key - */ - @JsonProperty(value = "SignedService", required = true) - private String signedService; - - /* - * The service version that created the key - */ - @JsonProperty(value = "SignedVersion", required = true) - private String signedVersion; - - /* - * The key as a base64 string - */ - @JsonProperty(value = "Value", required = true) - private String value; - - /** - * Get the signedOid property: The Azure Active Directory object ID in GUID - * format. - * - * @return the signedOid value. - */ - public String signedOid() { - return this.signedOid; - } - - /** - * Set the signedOid property: The Azure Active Directory object ID in GUID - * format. - * - * @param signedOid the signedOid value to set. - * @return the UserDelegationKey object itself. - */ - public UserDelegationKey signedOid(String signedOid) { - this.signedOid = signedOid; - return this; - } - - /** - * Get the signedTid property: The Azure Active Directory tenant ID in GUID - * format. - * - * @return the signedTid value. - */ - public String signedTid() { - return this.signedTid; - } - - /** - * Set the signedTid property: The Azure Active Directory tenant ID in GUID - * format. - * - * @param signedTid the signedTid value to set. - * @return the UserDelegationKey object itself. - */ - public UserDelegationKey signedTid(String signedTid) { - this.signedTid = signedTid; - return this; - } - - /** - * Get the signedStart property: The date-time the key is active. - * - * @return the signedStart value. - */ - public OffsetDateTime signedStart() { - return this.signedStart; - } - - /** - * Set the signedStart property: The date-time the key is active. - * - * @param signedStart the signedStart value to set. - * @return the UserDelegationKey object itself. - */ - public UserDelegationKey signedStart(OffsetDateTime signedStart) { - this.signedStart = signedStart; - return this; - } - - /** - * Get the signedExpiry property: The date-time the key expires. - * - * @return the signedExpiry value. - */ - public OffsetDateTime signedExpiry() { - return this.signedExpiry; - } - - /** - * Set the signedExpiry property: The date-time the key expires. - * - * @param signedExpiry the signedExpiry value to set. - * @return the UserDelegationKey object itself. - */ - public UserDelegationKey signedExpiry(OffsetDateTime signedExpiry) { - this.signedExpiry = signedExpiry; - return this; - } - - /** - * Get the signedService property: Abbreviation of the Azure Storage - * service that accepts the key. - * - * @return the signedService value. - */ - public String signedService() { - return this.signedService; - } - - /** - * Set the signedService property: Abbreviation of the Azure Storage - * service that accepts the key. - * - * @param signedService the signedService value to set. - * @return the UserDelegationKey object itself. - */ - public UserDelegationKey signedService(String signedService) { - this.signedService = signedService; - return this; - } - - /** - * Get the signedVersion property: The service version that created the - * key. - * - * @return the signedVersion value. - */ - public String signedVersion() { - return this.signedVersion; - } - - /** - * Set the signedVersion property: The service version that created the - * key. - * - * @param signedVersion the signedVersion value to set. - * @return the UserDelegationKey object itself. - */ - public UserDelegationKey signedVersion(String signedVersion) { - this.signedVersion = signedVersion; - return this; - } - - /** - * Get the value property: The key as a base64 string. - * - * @return the value value. - */ - public String value() { - return this.value; - } - - /** - * Set the value property: The key as a base64 string. - * - * @param value the value value to set. - * @return the UserDelegationKey object itself. - */ - public UserDelegationKey value(String value) { - this.value = value; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/blob/models/package-info.java b/storage/client/src/main/java/com/azure/storage/blob/models/package-info.java deleted file mode 100644 index 653e8a46d1d67..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/models/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -/** - * This package contains the data models for AzureBlobStorage. - */ -package com.azure.storage.blob.models; diff --git a/storage/client/src/main/java/com/azure/storage/blob/package-info.java b/storage/client/src/main/java/com/azure/storage/blob/package-info.java deleted file mode 100644 index 77e28d3d565ae..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/blob/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator - -/** - * This package contains the classes for StorageClient. - * Storage Client. - */ -package com.azure.storage.blob; diff --git a/storage/client/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java b/storage/client/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java deleted file mode 100644 index fe93273e3f64e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/common/credentials/SASTokenCredential.java +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.common.credentials; - -import com.azure.core.implementation.util.ImplUtils; - -import java.util.HashMap; - -/** - * Holds a SAS token used for authenticating requests. - */ -public final class SASTokenCredential { - // Required SAS token pieces - private static final String SIGNED_VERSION = "sv"; - private static final String SIGNED_SERVICES = "ss"; - private static final String SIGNED_RESOURCE_TYPES = "srt"; - private static final String SIGNED_PERMISSIONS = "sp"; - private static final String SIGNED_EXPIRY = "se"; - private static final String SIGNATURE = "sig"; - - // Optional SAS token pieces - private static final String SIGNED_START = "st"; - private static final String SIGNED_PROTOCOL = "spr"; - private static final String SIGNED_IP = "sip"; - - private final String sasToken; - - /** - * Creates a SAS token credential from the passed SAS token. - * @param sasToken SAS token used to authenticate requests with the service. - */ - public SASTokenCredential(String sasToken) { - this.sasToken = sasToken; - } - - /** - * @return the SAS token - */ - public String sasToken() { - return sasToken; - } - - /** - * Creates a SAS token credential from the passed URL query string - * @param query URL query used to build the SAS token - * @return a SAS token credential if the query param contains all the necessary pieces - */ - public static SASTokenCredential fromQuery(String query) { - if (ImplUtils.isNullOrEmpty(query)) { - return null; - } - - HashMap queryParams = new HashMap<>(); - for (String queryParam : query.split("&")) { - String key = queryParam.split("=", 2)[0]; - queryParams.put(key, queryParam); - } - - if (queryParams.size() < 6 - || !queryParams.containsKey(SIGNED_VERSION) - || !queryParams.containsKey(SIGNED_SERVICES) - || !queryParams.containsKey(SIGNED_RESOURCE_TYPES) - || !queryParams.containsKey(SIGNED_PERMISSIONS) - || !queryParams.containsKey(SIGNED_EXPIRY) - || !queryParams.containsKey(SIGNATURE)) { - return null; - } - - StringBuilder sasTokenBuilder = new StringBuilder(queryParams.get(SIGNED_VERSION)) - .append("&").append(queryParams.get(SIGNED_SERVICES)) - .append("&").append(queryParams.get(SIGNED_RESOURCE_TYPES)) - .append("&").append(queryParams.get(SIGNED_PERMISSIONS)); - - // SIGNED_START is optional - if (queryParams.containsKey(SIGNED_START)) { - sasTokenBuilder.append("&").append(queryParams.get(SIGNED_START)); - } - - sasTokenBuilder.append("&").append(queryParams.get(SIGNED_EXPIRY)); - - // SIGNED_IP is optional - if (queryParams.containsKey(SIGNED_IP)) { - sasTokenBuilder.append("&").append(queryParams.get(SIGNED_IP)); - } - - // SIGNED_PROTOCOL is optional - if (queryParams.containsKey(SIGNED_PROTOCOL)) { - sasTokenBuilder.append("&").append(queryParams.get(SIGNED_PROTOCOL)); - } - - sasTokenBuilder.append("&").append(queryParams.get(SIGNATURE)); - - return new SASTokenCredential(sasTokenBuilder.toString()); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java b/storage/client/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java deleted file mode 100644 index 546ce682d0077..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/common/credentials/SharedKeyCredential.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.common.credentials; - -import com.azure.core.implementation.util.ImplUtils; -import io.netty.handler.codec.http.QueryStringDecoder; - -import javax.crypto.Mac; -import javax.crypto.spec.SecretKeySpec; -import java.net.URL; -import java.nio.charset.StandardCharsets; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.util.ArrayList; -import java.util.Base64; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * SharedKey credential policy that is put into a header to authorize requests. - */ -public final class SharedKeyCredential { - private static final String AUTHORIZATION_HEADER_FORMAT = "SharedKey %s:%s"; - - // Pieces of the connection string that are needed. - private static final String ACCOUNT_NAME = "AccountName".toLowerCase(); - private static final String ACCOUNT_KEY = "AccountKey".toLowerCase(); - - private final String accountName; - private final byte[] accountKey; - - /** - * Initializes a new instance of SharedKeyCredentials contains an account's name and its primary or secondary - * accountKey. - * - * @param accountName The account name associated with the request. - * @param accountKey The account access key used to authenticate the request. - */ - public SharedKeyCredential(String accountName, String accountKey) { - this.accountName = accountName; - this.accountKey = Base64.getDecoder().decode(accountKey); - } - - /** - * Creates a SharedKey credential from the passed connection string. - * @param connectionString Connection string used to build the SharedKey credential. - * @return a SharedKey credential if the connection string contains AccountName and AccountKey - * @throws IllegalArgumentException If {@code connectionString} doesn't have AccountName or AccountKey. - */ - public static SharedKeyCredential fromConnectionString(String connectionString) { - HashMap connectionStringPieces = new HashMap<>(); - for (String connectionStringPiece : connectionString.split(";")) { - String[] kvp = connectionStringPiece.split("=", 2); - connectionStringPieces.put(kvp[0].toLowerCase(), kvp[1]); - } - - String accountName = connectionStringPieces.get(ACCOUNT_NAME); - String accountKey = connectionStringPieces.get(ACCOUNT_KEY); - - if (ImplUtils.isNullOrEmpty(accountName) || ImplUtils.isNullOrEmpty(accountKey)) { - throw new IllegalArgumentException("Connection string must contain 'AccountName' and 'AccountKey'."); - } - - return new SharedKeyCredential(accountName, accountKey); - } - - /** - * Generates the SharedKey Authorization value from information in the request. - * @param requestURL URL of the request - * @param httpMethod HTTP method being used - * @param headers Headers on the request - * @return the SharedKey authorization value - */ - public String generateAuthorizationHeader(URL requestURL, String httpMethod, Map headers) { - return computeHMACSHA256(buildStringToSign(requestURL, httpMethod, headers)); - } - - private String buildStringToSign(URL requestURL, String httpMethod, Map headers) { - String contentLength = headers.get("Content-Length"); - contentLength = contentLength.equals("0") ? "" : contentLength; - - // If the x-ms-header exists ignore the Date header - String dateHeader = (headers.containsKey("x-ms-date")) ? "" : headers.getOrDefault("Date", ""); - - return String.join("\n", - httpMethod, - getStandardHeaderValue(headers, "Content-Encoding"), - getStandardHeaderValue(headers, "Content-Language"), - contentLength, - getStandardHeaderValue(headers, "Content-MD5"), - getStandardHeaderValue(headers, "Content-Type"), - dateHeader, - getStandardHeaderValue(headers, "If-Modified-Since"), - getStandardHeaderValue(headers, "If-Match"), - getStandardHeaderValue(headers, "If-None-Match"), - getStandardHeaderValue(headers, "If-Unmodified-Since"), - getStandardHeaderValue(headers, "Range"), - getAdditionalXmsHeaders(headers), - getCanonicalizedResource(requestURL)); - } - - private String getAdditionalXmsHeaders(Map headers) { - // Add only headers that begin with 'x-ms-' - final List xmsHeaderNameArray = headers.entrySet().stream() - .filter(entry -> entry.getKey().toLowerCase(Locale.ROOT).startsWith("x-ms-")) - .filter(entry -> entry.getValue() != null) - .map(Map.Entry::getKey) - .collect(Collectors.toList()); - - if (xmsHeaderNameArray.isEmpty()) { - return ""; - } - - Collections.sort(xmsHeaderNameArray); - - final StringBuilder canonicalizedHeaders = new StringBuilder(); - for (final String key : xmsHeaderNameArray) { - if (canonicalizedHeaders.length() > 0) { - canonicalizedHeaders.append('\n'); - } - - canonicalizedHeaders.append(key) - .append(':') - .append(headers.get(key)); - } - - return canonicalizedHeaders.toString(); - } - - private String getCanonicalizedResource(URL requestURL) { - - // Resource path - final StringBuilder canonicalizedResource = new StringBuilder("/"); - canonicalizedResource.append(accountName); - - // Note that AbsolutePath starts with a '/'. - if (requestURL.getPath().length() > 0) { - canonicalizedResource.append(requestURL.getPath()); - } else { - canonicalizedResource.append('/'); - } - - // check for no query params and return - if (requestURL.getQuery() == null) { - return canonicalizedResource.toString(); - } - - // The URL object's query field doesn't include the '?'. The QueryStringDecoder expects it. - QueryStringDecoder queryDecoder = new QueryStringDecoder("?" + requestURL.getQuery()); - Map> queryParams = queryDecoder.parameters(); - - ArrayList queryParamNames = new ArrayList<>(queryParams.keySet()); - Collections.sort(queryParamNames); - - for (String queryParamName : queryParamNames) { - final List queryParamValues = queryParams.get(queryParamName); - Collections.sort(queryParamValues); - String queryParamValuesStr = String.join(",", queryParamValues); - canonicalizedResource.append("\n") - .append(queryParamName.toLowerCase(Locale.ROOT)) - .append(":") - .append(queryParamValuesStr); - } - - // append to main string builder the join of completed params with new line - return canonicalizedResource.toString(); - } - - private String computeHMACSHA256(String stringToSign) { - try { - Mac hmacSha256 = Mac.getInstance("HmacSHA256"); - hmacSha256.init(new SecretKeySpec(accountKey, "HmacSHA256")); - byte[] utf8Bytes = stringToSign.getBytes(StandardCharsets.UTF_8); - String signature = Base64.getEncoder().encodeToString(hmacSha256.doFinal(utf8Bytes)); - return String.format(AUTHORIZATION_HEADER_FORMAT, accountName, signature); - } catch (NoSuchAlgorithmException | InvalidKeyException ex) { - throw new Error(ex); - } - } - - /** - * Returns the standard header value from the specified connection request, or an empty string if no header value - * has been specified for the request. - * - * @param httpHeaders - * A {@code HttpHeaders} object that represents the headers for the request. - * @param headerName - * A {@code String} that represents the name of the header being requested. - * - * @return A {@code String} that represents the header value, or {@code null} if there is no corresponding - * header value for {@code headerName}. - */ - private String getStandardHeaderValue(final Map httpHeaders, final String headerName) { - final String headerValue = httpHeaders.get(headerName); - return headerValue == null ? "" : headerValue; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/common/credentials/package-info.java b/storage/client/src/main/java/com/azure/storage/common/credentials/package-info.java deleted file mode 100644 index dec5d32cde0ab..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/common/credentials/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -/** - * This package contains credential used by Azure Storage services. - */ -package com.azure.storage.common.credentials; diff --git a/storage/client/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java b/storage/client/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java deleted file mode 100644 index ba2debfcd3620..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/common/policy/SASTokenCredentialPolicy.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.common.policy; - -import com.azure.core.http.HttpPipelineCallContext; -import com.azure.core.http.HttpPipelineNextPolicy; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.implementation.util.ImplUtils; -import com.azure.storage.common.credentials.SASTokenCredential; -import reactor.core.publisher.Mono; - -import java.net.MalformedURLException; -import java.net.URL; - -/** - * Policy that adds the SAS token to the request URL's query. - */ -public final class SASTokenCredentialPolicy implements HttpPipelinePolicy { - private final SASTokenCredential credential; - - /** - * Creates a SAS token credential policy that appends the SAS token to the request URL's query. - * @param credential SAS token credential - */ - public SASTokenCredentialPolicy(SASTokenCredential credential) { - this.credential = credential; - } - - @Override - public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - try { - URL requestURL = context.httpRequest().url(); - String delimiter = !ImplUtils.isNullOrEmpty(requestURL.getQuery()) ? "&" : "?"; - - String newURL = requestURL.toString() + delimiter + credential.sasToken(); - context.httpRequest().url(new URL(newURL)); - } catch (MalformedURLException ex) { - throw new IllegalStateException(ex); - } - - return next.process(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/common/policy/SharedKeyCredentialPolicy.java b/storage/client/src/main/java/com/azure/storage/common/policy/SharedKeyCredentialPolicy.java deleted file mode 100644 index 8ee1284591dd2..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/common/policy/SharedKeyCredentialPolicy.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.common.policy; - -import com.azure.core.http.HttpPipelineCallContext; -import com.azure.core.http.HttpPipelineNextPolicy; -import com.azure.core.http.HttpResponse; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.storage.common.credentials.SharedKeyCredential; -import reactor.core.publisher.Mono; - -/** - * Policy that adds the SharedKey into the request's Authorization header. - */ -public final class SharedKeyCredentialPolicy implements HttpPipelinePolicy { - private final SharedKeyCredential credential; - - /** - * Creates a SharedKey pipeline policy that adds the SharedKey into the request's authorization header. - * @param credential the SharedKey credential used to create the policy. - */ - public SharedKeyCredentialPolicy(SharedKeyCredential credential) { - this.credential = credential; - } - - @Override - public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - String authorizationValue = credential.generateAuthorizationHeader(context.httpRequest().url(), - context.httpRequest().httpMethod().toString(), - context.httpRequest().headers().toMap()); - context.httpRequest().header("Authorization", authorizationValue); - return next.process(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/common/policy/package-info.java b/storage/client/src/main/java/com/azure/storage/common/policy/package-info.java deleted file mode 100644 index 6f36065ea580b..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/common/policy/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -/** - * This package contains policies used by Azure Storage services. - */ -package com.azure.storage.common.policy; diff --git a/storage/client/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java b/storage/client/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java deleted file mode 100644 index 00085687cf8fb..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/DirectoryAsyncClient.java +++ /dev/null @@ -1,529 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.http.rest.VoidResponse; -import com.azure.core.util.Context; -import com.azure.storage.common.credentials.SASTokenCredential; -import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.file.implementation.AzureFileStorageBuilder; -import com.azure.storage.file.implementation.AzureFileStorageImpl; -import com.azure.storage.file.models.DirectoryInfo; -import com.azure.storage.file.models.DirectoryProperties; -import com.azure.storage.file.models.DirectorySetMetadataInfo; -import com.azure.storage.file.models.DirectorysCreateResponse; -import com.azure.storage.file.models.DirectorysForceCloseHandlesResponse; -import com.azure.storage.file.models.DirectorysGetPropertiesResponse; -import com.azure.storage.file.models.DirectorysListFilesAndDirectoriesSegmentResponse; -import com.azure.storage.file.models.DirectorysListHandlesResponse; -import com.azure.storage.file.models.DirectorysSetMetadataResponse; -import com.azure.storage.file.models.FileHTTPHeaders; -import com.azure.storage.file.models.FileRef; -import com.azure.storage.file.models.HandleItem; -import com.azure.storage.file.models.StorageErrorException; -import java.net.URL; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * This class provides a client that contains all the operations for interacting with directory in Azure Storage File Service. - * Operations allowed by the client are creating, deleting and listing subdirectory and file, retrieving properties, , setting metadata - * and list or force close handles of the directory or file. - * - *

Instantiating an Asynchronous Directory Client

- * - *
- * DirectoryAsyncClient client = DirectoryAsyncClient.builder()
- *     .connectionString(connectionString)
- *     .endpoint(endpoint)
- *     .buildAsync();
- * 
- * - *

View {@link DirectoryClientBuilder this} for additional ways to construct the client.

- * - * @see DirectoryClientBuilder - * @see DirectoryClient - * @see SharedKeyCredential - * @see SASTokenCredential - */ -public class DirectoryAsyncClient { - private final AzureFileStorageImpl azureFileStorageClient; - private final String shareName; - private final String directoryName; - private final String shareSnapshot; - - /** - * Creates a DirectoryAsyncClient that sends requests to the storage directory at {@link AzureFileStorageImpl#url() endpoint}. - * Each service call goes through the {@link HttpPipeline pipeline} in the {@code client}. - * @param azureFileStorageClient Client that interacts with the service interfaces - * @param shareName Name of the share - * @param directoryName Name of the directory - * @param shareSnapshot The snapshot of the share - */ - DirectoryAsyncClient(AzureFileStorageImpl azureFileStorageClient, String shareName, String directoryName, String shareSnapshot) { - this.shareName = shareName; - this.directoryName = directoryName; - this.shareSnapshot = shareSnapshot; - this.azureFileStorageClient = new AzureFileStorageBuilder().pipeline(azureFileStorageClient.httpPipeline()) - .url(azureFileStorageClient.url()) - .version(azureFileStorageClient.version()) - .build(); - } - - /** - * Creates a DirectoryAsyncClient that sends requests to the storage account at {@code endpoint}. - * Each service call goes through the {@code httpPipeline}. - * @param endpoint URL for the Storage File service - * @param httpPipeline HttpPipeline that HTTP requests and response flow through - * @param shareName Name of the share - * @param directoryName Name of the directory - * @param shareSnapshot Optional. The snapshot of the share - */ - DirectoryAsyncClient(URL endpoint, HttpPipeline httpPipeline, String shareName, String directoryName, String shareSnapshot) { - this.shareName = shareName; - this.directoryName = directoryName; - this.shareSnapshot = shareSnapshot; - this.azureFileStorageClient = new AzureFileStorageBuilder().pipeline(httpPipeline) - .url(endpoint.toString()) - .build(); - } - - /** - * Creates a builder that can configure options for the DirectoryAsyncClient before creating an instance of it. - * - * @return A new {@link DirectoryClientBuilder} used to create DirectoryAsyncClient instances. - */ - public static DirectoryClientBuilder builder() { - return new DirectoryClientBuilder(); - } - - /** - * Get the getDirectoryUrl of the storage directory client. - * @return the URL of the storage directory client - */ - public String getDirectoryUrl() { - return azureFileStorageClient.url(); - } - - /** - * Constructs a FileAsyncClient that interacts with the specified file. - * - *

If the file doesn't exist in the storage account {@link FileAsyncClient#create(long)} create} in the client will - * need to be called before interaction with the file can happen.

- * - * @param fileName Name of the file - * @return a FileAsyncClient that interacts with the specified share - */ - public FileAsyncClient getFileClient(String fileName) { - String filePath = directoryName + "/" + fileName; - return new FileAsyncClient(azureFileStorageClient, shareName, filePath, null); - } - - /** - * Constructs a DirectoryAsyncClient that interacts with the specified directory. - * - *

If the file doesn't exist in the storage account {@link DirectoryAsyncClient#create()} create} in the client will - * need to be called before interaction with the directory can happen.

- * - * @param directoryName Name of the directory - * @return a DirectoryAsyncClient that interacts with the specified directory - */ - public DirectoryAsyncClient getSubDirectoryClient(String directoryName) { - return new DirectoryAsyncClient(azureFileStorageClient, shareName, directoryName, shareSnapshot); - } - - /** - * Creates a directory in the storage account and returns a response of {@link DirectoryInfo} to interact with it. - * - *

Code Samples

- * - *

Create the directory

- * - * {@codesnippet com.azure.storage.file.directoryAsyncClient.create} - * - * @return A response containing the directory info and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. - */ - public Mono> create() { - return create(null); - } - - /** - * Creates a directory in the storage account and returns a response of DirectoryInfo to interact with it. - * - *

Code Samples

- * - *

Create the directory

- * - *
-     * client.create(Collections.singletonMap("directory", "metadata"))
-     *     .subscribe(response -> System.out.printf("Creating the directory completed with status code %d", response.statusCode()));
-     * 
- * - * @param metadata Optional. Metadata to associate with the directory - * @return A response containing the directory info and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. - */ - public Mono> create(Map metadata) { - return azureFileStorageClient.directorys().createWithRestResponseAsync(shareName, directoryName,null, metadata, Context.NONE) - .map(this::createWithRestResponse); - } - - /** - * Deletes the directory in the storage account. - * - *

Code Samples

- * - *

Delete the directory

- * - * {@codesnippet com.azure.storage.file.directoryClient.delete} - * - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist - */ - public Mono delete() { - return azureFileStorageClient.directorys().deleteWithRestResponseAsync(shareName, directoryName, Context.NONE).map(VoidResponse::new) - .map(VoidResponse::new); - } - - /** - * Retrieves the properties of the storage account's directory. - * The properties includes directory metadata, last modified date, is server encrypted, and eTag. - * - *

Code Samples

- * - *

Retrieve directory properties

- * - *
-     * client.getProperties()
-     *    .subscribe(response -> {
-     *        DirectoryProperties properties = response.value();
-     *        System.out.printf("Directory latest modified date is %s.", properties.lastModified());
-     *    });
-     * 
- * - * @return Storage directory properties - */ - public Mono> getProperties() { - return azureFileStorageClient.directorys().getPropertiesWithRestResponseAsync(shareName, directoryName, shareSnapshot, null, Context.NONE) - .map(this::getPropertiesResponse); - } - - /** - * Sets the user-defined metadata to associate to the directory. - * - *

If {@code null} is passed for the metadata it will clear the metadata associated to the directory.

- * - *

Code Samples

- * - *

Set the metadata to "directory:updatedMetadata"

- * - *
-     * client.setMetadata(Collections.singletonMap("directory", "updatedMetadata"))
-     *     .subscribe(response -> System.out.printf("Setting the directory metadata completed with status code %d", response.statusCode()));
-     * 
- * - *

Clear the metadata of the directory

- * - *
-     * client.setMetadata(null)
-     *     .subscribe(response -> System.out.printf("Clearing the directory metadata completed with status code %d", response.statusCode()));
-     * 
- * - * @param metadata Optional. Metadata to set on the directory, if null is passed the metadata for the directory is cleared - * @return information about the directory - * @throws StorageErrorException If the directory doesn't exist or the metadata contains invalid keys - */ - public Mono> setMetadata(Map metadata) { - return azureFileStorageClient.directorys().setMetadataWithRestResponseAsync(shareName, directoryName, null, metadata, Context.NONE) - .map(this::setMetadataResponse); - } - - /** - * Lists all directories and files in the storage account without their prefix or maxResult. - * - *

Code Samples

- * - *

List all directories and files in the account

- * - *
-     * client.listFilesAndDirectories()
-     *     .subscribe(result -> System.out.printf("The file or directory %s exists in the account", result.name()));
-     * 
- * - * @return {@link FileRef File info} in the storage directory - */ - public Flux listFilesAndDirectories() { - return listFilesAndDirectories(null, null); - } - - /** - * Lists all shares in the storage account with their prefix or snapshots. - * - *

Code Samples

- * - *

List all directories with "subdir" prefix and return 10 results in the account

- * - * {@codesnippet com.azure.storage.file.directoryAsyncClient.listFilesAndDirectories} - * - * @param prefix Optional. Filters the results to return only files and directories whose name begins with the specified prefix. - * @param maxResults Optional. Specifies the maximum number of files and/or directories to return per page. - * If the request does not specify maxresults or specifies a value greater than 5,000, the server will return up to 5,000 items. - * @return {@link FileRef File info} in the storage account with prefix and max number of return results. - */ - public Flux listFilesAndDirectories(String prefix, Integer maxResults) { - return azureFileStorageClient.directorys().listFilesAndDirectoriesSegmentWithRestResponseAsync(shareName, directoryName, prefix, shareSnapshot, null, maxResults, null, Context.NONE) - .flatMapMany(response -> nextPageForFileAndDirecotries(response, prefix, maxResults)); - } - - /** - * List of open handles on a directory or a file. - * - *

Code Samples

- * - *

Get 10 handles with recursive call.

- * - *
-     * client.getHandles(10, true)
-     *     .subscribe(handleItem -> System.out.printf("Get handles completed with handle id %s", handleItem.handleId()));
-     * 
- * @param maxResult Optional. The number of results will return per page - * @param recursive Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. - * @return {@link HandleItem handles} in the directory that satisfy the requirements - */ - public Flux getHandles(Integer maxResult, boolean recursive) { - return azureFileStorageClient.directorys().listHandlesWithRestResponseAsync(shareName, directoryName, null, maxResult, null, shareSnapshot, recursive, Context.NONE) - .flatMapMany(response -> nextPageForHandles(response, maxResult, recursive)); - } - - /** - * Closes a handle or handles opened on a directory or a file at the service. It is intended to be used alongside {@link DirectoryAsyncClient#getHandles(Integer, boolean)} . - * - *

Code Samples

- * - *

Force close handles with handles returned by get handles in recursive.

- * - *
-     * client.getHandles(10, true)
-     *     .subscribe(handleItem -> {
-     *         client.forceCloseHandles(handleItem.handleId(), true).subscribe(numOfClosedHandles ->
-     *              System.out.printf("Close %d handles.", numOfClosedHandles)
-     *     )});
-     * 
- * @param handleId Specifies the handle ID to be closed. Use an asterisk ('*') as a wildcard string to specify all handles. - * @param recursive A boolean value that specifies if the operation should also apply to the files and subdirectories of the directory specified in the URI. - * @return The counts of number of handles closed - */ - public Flux forceCloseHandles(String handleId, boolean recursive) { - return azureFileStorageClient.directorys().forceCloseHandlesWithRestResponseAsync(shareName, directoryName, handleId, null, null, shareSnapshot, recursive, Context.NONE) - .flatMapMany(response -> nextPageForForceCloseHandles(response, handleId, recursive)); - } - - /** - * Creates a subdirectory under current directory with specific name and returns a response of DirectoryAsyncClient to interact with it. - * - *

Code Samples

- * - *

Create the sub directory "subdir"

- * - * {@codesnippet com.azure.storage.file.directoryAsyncClient.createSubDirectory#string} - * - * @param subDirectoryName Name of the subdirectory - * @return A response containing the subdirectory client and the status of creating the directory. - * @throws StorageErrorException If the subdirectory has already existed, the parent directory does not exist or directory is an invalid resource name. - */ - public Mono> createSubDirectory(String subDirectoryName) { - String directoryPath = directoryName + "/" + subDirectoryName; - DirectoryAsyncClient createSubClient = new DirectoryAsyncClient(azureFileStorageClient, shareName, directoryPath, shareSnapshot); - return createSubClient.create() - .map(response -> mapResponse(response, createSubClient)); - } - - /** - * Creates a subdirectory under current directory with specific name , metadata and returns a response of DirectoryAsyncClient to interact with it. - * - *

Code Samples

- * - *

Create the subdirectory named "subdir", with metadata

- * - *
-     * client.createSubDirectory("subdir", Collections.singletonMap("directory", "metadata"))
-     *     .subscribe(response -> System.out.printf("Creating the subdirectory completed with status code %d", response.statusCode()));
-     * 
- * - * @param subDirectoryName Name of the subdirectory - * @param metadata Optional. Metadata to associate with the subdirectory - * @return A response containing the subdirectory client and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or subdirectory is an invalid resource name. - */ - public Mono> createSubDirectory(String subDirectoryName, Map metadata) { - String directoryPath = directoryName + "/" + subDirectoryName; - DirectoryAsyncClient createSubClient = new DirectoryAsyncClient(azureFileStorageClient, shareName, directoryPath, shareSnapshot); - return createSubClient.create(metadata) - .map(response -> mapResponse(response, createSubClient)); - } - - /** - * Deletes the subdirectory with specific name in the storage account. - * - *

Code Samples

- * - *

Delete the subdirectory named "subdir"

- * - * {@codesnippet com.azure.storage.file.directoryAsyncClient.deleteSubDirectory#string} - * - * @param subDirectoryName Name of the subdirectory - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the subdirectory doesn't exist, the parent directory does not exist or subdirectory name is an invalid resource name. - */ - public Mono deleteSubDirectory(String subDirectoryName) { - String directoryPath = directoryName + "/" + subDirectoryName; - DirectoryAsyncClient deleteSubClient = new DirectoryAsyncClient(azureFileStorageClient, shareName, directoryPath, shareSnapshot); - return deleteSubClient.delete().map(VoidResponse::new); - } - - /** - * Creates a file in the storage account with specific name, max number of results and returns a response of DirectoryInfo to interact with it. - * - *

Code Samples

- * - *

Create 1k file with named "myFile"

- * - * {@codesnippet com.azure.storage.file.directoryAsyncClient.createFile#string-long} - * - * @param fileName Name of the file - * @param maxSize Size of the file - * @return A response containing the FileAsyncClient and the status of creating the directory. - * @throws StorageErrorException If the file has already existed, the parent directory does not exist or file name is an invalid resource name. - */ - public Mono> createFile(String fileName, long maxSize) { - String filePath = directoryName + "/" + fileName; - FileAsyncClient fileAsyncClient = new FileAsyncClient(azureFileStorageClient, shareName, filePath, shareSnapshot); - return fileAsyncClient.create(maxSize).map(response -> mapResponse(response, fileAsyncClient)); - } - - /** - * Creates a file in the storage account with specific name and returns a response of DirectoryInfo to interact with it. - * - *

Code Samples

- * - *

Create the file named "myFile"

- * - *
-     * client.createFile("myFile", Collections.singletonMap("directory", "metadata"))
-     *     .subscribe(response -> System.out.printf("Creating the file completed with status code %d", response.statusCode()));
-     * 
- * - * @param fileName Name of the file - * @param maxSize Max size of the file - * @param httpHeaders the Http headers set to the file - * @param metadata Optional. Name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. - * @return A response containing the directory info and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or file name is an invalid resource name. - */ - public Mono> createFile(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { - String filePath = directoryName + "/" + fileName; - FileAsyncClient fileAsyncClient = new FileAsyncClient(azureFileStorageClient, shareName, filePath, shareSnapshot); - return fileAsyncClient.create(maxSize, httpHeaders, metadata).map(response -> mapResponse(response, fileAsyncClient)); - } - - /** - * Deletes the file with specific name in the storage account. - * - *

Code Samples

- * - *

Delete the file "filetest"

- * - * {@codesnippet com.azure.storage.file.directoryAsyncClient.deleteFile#string} - * - * @param fileName Name of the file - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist or file name is an invalid resource name. - */ - public Mono deleteFile(String fileName) { - String filePath = directoryName + "/" + fileName; - FileAsyncClient fileAsyncClient = new FileAsyncClient(azureFileStorageClient, shareName, filePath, shareSnapshot); - return fileAsyncClient.delete().map(VoidResponse::new); - } - - - private Response createWithRestResponse(final DirectorysCreateResponse response) { - String eTag = response.deserializedHeaders().eTag(); - OffsetDateTime lastModified = response.deserializedHeaders().lastModified(); - DirectoryInfo directoryInfo = new DirectoryInfo(eTag, lastModified); - return mapResponse(response, directoryInfo); - - } - - private Response getPropertiesResponse(DirectorysGetPropertiesResponse response) { - Map metadata = response.deserializedHeaders().metadata(); - String eTag = response.deserializedHeaders().eTag(); - OffsetDateTime offsetDateTime = response.deserializedHeaders().lastModified(); - boolean isServerEncrypted = response.deserializedHeaders().isServerEncrypted(); - - DirectoryProperties directoryProperties = new DirectoryProperties(metadata, eTag, offsetDateTime, isServerEncrypted); - return mapResponse(response, directoryProperties); - } - - private Response setMetadataResponse(final DirectorysSetMetadataResponse response) { - String eTag = response.deserializedHeaders().eTag(); - boolean isServerEncrypted = response.deserializedHeaders().isServerEncrypted(); - - DirectorySetMetadataInfo directorySetMetadataInfo = new DirectorySetMetadataInfo(eTag, isServerEncrypted); - return mapResponse(response, directorySetMetadataInfo); - } - - static SimpleResponse mapResponse(Response response, T value) { - return new SimpleResponse<>(response.request(), response.statusCode(), response.headers(), value); - } - - private Flux nextPageForFileAndDirecotries(final DirectorysListFilesAndDirectoriesSegmentResponse response, final String prefix, final Integer maxResult) { - List fileRefs = convertResponseAndGetNumOfResults(response); - - if (response.value().nextMarker() == null) { - return Flux.fromIterable(fileRefs); - } - Mono listResponse = azureFileStorageClient.directorys().listFilesAndDirectoriesSegmentWithRestResponseAsync(shareName, directoryName, prefix, shareSnapshot, response.value().nextMarker(), maxResult, null, Context.NONE); - Flux fileRefPublisher = listResponse.flatMapMany(newResponse ->nextPageForFileAndDirecotries(newResponse, prefix, maxResult)); - return Flux.fromIterable(fileRefs).concatWith(fileRefPublisher); - } - - private Flux nextPageForHandles (DirectorysListHandlesResponse response, Integer maxResult, boolean recursive) { - List handleItems = response.value().handleList(); - - if (response.value().nextMarker() == null) { - return Flux.fromIterable(handleItems); - } - Mono listResponse = azureFileStorageClient.directorys().listHandlesWithRestResponseAsync(shareName, directoryName, response.value().nextMarker(), maxResult, null, shareSnapshot, recursive, Context.NONE); - Flux fileRefPublisher = listResponse.flatMapMany(newResponse -> nextPageForHandles(newResponse, maxResult, recursive)); - return Flux.fromIterable(handleItems).concatWith(fileRefPublisher); - } - - private Flux nextPageForForceCloseHandles(DirectorysForceCloseHandlesResponse response, String handleId, boolean recursive) { - List handleCount = Arrays.asList(response.deserializedHeaders().numberOfHandlesClosed()); - - if (response.deserializedHeaders().marker() == null) { - return Flux.fromIterable(handleCount); - } - Mono listResponse = azureFileStorageClient.directorys().forceCloseHandlesWithRestResponseAsync(shareName, directoryName, handleId, null, response.deserializedHeaders().marker(), shareSnapshot, recursive, Context.NONE); - Flux fileRefPublisher = listResponse.flatMapMany(newResponse -> nextPageForForceCloseHandles(newResponse, handleId, recursive)); - return Flux.fromIterable(handleCount).concatWith(fileRefPublisher); - } - - private List convertResponseAndGetNumOfResults(DirectorysListFilesAndDirectoriesSegmentResponse response){ - List fileRefs = new ArrayList<>(); - response.value().segment().directoryItems().forEach(directoryItem -> fileRefs.add(new FileRef(directoryItem.name(), true, null))); - response.value().segment().fileItems().forEach(fileItem -> fileRefs.add(new FileRef(fileItem.name(), false, fileItem.properties()))); - return fileRefs; - } - -} diff --git a/storage/client/src/main/java/com/azure/storage/file/DirectoryClient.java b/storage/client/src/main/java/com/azure/storage/file/DirectoryClient.java deleted file mode 100644 index 83f59977a1171..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/DirectoryClient.java +++ /dev/null @@ -1,393 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.http.rest.VoidResponse; -import com.azure.storage.common.credentials.SASTokenCredential; -import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.file.models.DirectoryInfo; -import com.azure.storage.file.models.DirectoryProperties; -import com.azure.storage.file.models.DirectorySetMetadataInfo; -import com.azure.storage.file.models.FileHTTPHeaders; -import com.azure.storage.file.models.FileRef; -import com.azure.storage.file.models.HandleItem; -import com.azure.storage.file.models.StorageErrorException; -import java.util.Map; - -/** - * This class provides a client that contains all the operations for interacting with directory in Azure Storage File Service. - * Operations allowed by the client are creating, deleting and listing subdirectory and file, retrieving properties, , setting metadata - * and list or force close handles of the directory or file. - * - *

Instantiating an Synchronous Directory Client

- * - *
- * DirectoryClient client = DirectoryClient.builder()
- *     .connectionString(connectionString)
- *     .endpoint(endpoint)
- *     .build();
- * 
- * - *

View {@link DirectoryClientBuilder this} for additional ways to construct the client.

- * - * @see DirectoryClientBuilder - * @see DirectoryClient - * @see SharedKeyCredential - * @see SASTokenCredential - */ -public class DirectoryClient { - - public final DirectoryAsyncClient directoryAsyncClient; - - /** - * Creates a DirectoryClient that wraps a DirectoryAsyncClient and blocks requests. - * - * @param directoryAsyncClient DirectoryAsyncClient that is used to send requests - */ - DirectoryClient(DirectoryAsyncClient directoryAsyncClient) { - this.directoryAsyncClient = directoryAsyncClient; - } - - /** - * Creates a builder that can configure options for the DirectoryClient before creating an instance of it. - * - * @return A new {@link DirectoryClientBuilder} used to create DirectoryClient instances. - */ - public static DirectoryClientBuilder builder() { - return new DirectoryClientBuilder(); - } - - /** - * Get the getDirectoryUrl of the storage directory client. - * @return the URL of the storage directory client - */ - public String getDirectoryUrl() { - return directoryAsyncClient.getDirectoryUrl(); - } - - /** - * Constructs a FileClient that interacts with the specified file. - * - *

If the file doesn't exist in the storage account {@link FileClient#create(long)} create} in the client will - * need to be called before interaction with the file can happen.

- * - * @param fileName Name of the file - * @return a FileClient that interacts with the specified share - */ - public FileClient getFileClient(String fileName) { - return new FileClient(directoryAsyncClient.getFileClient(fileName)); - } - - /** - * Constructs a DirectoryClient that interacts with the specified directory. - * - *

If the file doesn't exist in the storage account {@link DirectoryClient#create()} create} in the client will - * need to be called before interaction with the directory can happen.

- * - * @param directoryName Name of the directory - * @return a DirectoryClient that interacts with the specified directory - */ - public DirectoryClient getSubDirectoryClient(String directoryName) { - return new DirectoryClient(directoryAsyncClient.getSubDirectoryClient(directoryName)); - } - - /** - * Creates a directory in the storage account and returns a response of {@link DirectoryInfo} to interact with it. - * - *

Code Samples

- * - *

Create the directory

- * - * {@codesnippet com.azure.storage.file.directoryClient.createDirectory} - * - * @return A response containing the directory info and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. - */ - public Response create() { - return create(null); - } - - /** - * Creates a directory in the storage account and returns a response of DirectoryInfo to interact with it. - * - *

Code Samples

- * - *

Create the directory

- * - *
-     * Response<DirectoryInfo> response = client.create(Collections.singletonMap("directory", "metadata"));
-     * System.out.printf("Creating the directory completed with status code %d", response.statusCode());
-     * 
- * - * @param metadata Optional. Metadata to associate with the directory - * @return A response containing the directory info and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory name is an invalid resource name. - */ - public Response create(Map metadata) { - return directoryAsyncClient.create(metadata).block(); - } - - /** - * Deletes the directory in the storage account. The directory must be empty before it can be deleted. - * - *

Code Samples

- * - *

Delete the directory

- * - * {@codesnippet com.azure.storage.file.directoryClient.delete} - * - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist - */ - public VoidResponse delete() { - return directoryAsyncClient.delete().block(); - } - - /** - * Retrieves the properties of the storage account's directory. - * The properties includes directory metadata, last modified date, is server encrypted, and eTag. - * - *

Code Samples

- * - *

Retrieve directory properties

- * - *
-     * Response<DirectoryProperties> response = client.getProperties();
-     * System.out.printf("Directory latest modified date is %s.", properties.value().lastModified());
-     * 
- * - * @return Storage directory properties - */ - public Response getProperties() { - return directoryAsyncClient.getProperties().block(); - } - - /** - * Sets the user-defined metadata to associate to the directory. - * - *

If {@code null} is passed for the metadata it will clear the metadata associated to the directory.

- * - *

Code Samples

- * - *

Set the metadata to "directory:updatedMetadata"

- * - *
-     * Response<DirectorySetMetadataInfo> response = client.setMetadata(Collections.singletonMap("directory", "updatedMetadata"));
-     * System.out.printf("Setting the directory metadata completed with status code %d", response.statusCode());
-     * 
- * - *

Clear the metadata of the directory

- * - *
-     * client.setMetadata(null)
-     *     .subscribe(response -> System.out.printf("Clearing the directory metadata completed with status code %d", response.statusCode()));
-     * 
- * - * @param metadata Optional. Metadata to set on the directory, if null is passed the metadata for the directory is cleared - * @return information about the directory - * @throws StorageErrorException If the directory doesn't exist or the metadata contains invalid keys - */ - public Response setMetadata(Map metadata) { - return directoryAsyncClient.setMetadata(metadata).block(); - } - - /** - * Lists all directories and files in the storage account without their prefix or maxResult. - * - *

Code Samples

- * - *

List all directories and files in the account

- * - *
-     * Iterable<FileRef> result = client.listFilesAndDirectories()
-     * System.out.printf("The file or directory %s exists in the account", result.iterator().next().name());
-     * 
- * - * @return {@link FileRef File info} in the storage directory - */ - public Iterable listFilesAndDirectories() { - return listFilesAndDirectories(null, null); - } - - /** - * Lists all shares in the storage account with their prefix or snapshots. - * - *

Code Samples

- * - *

List all directories with "subdir" prefix and return 10 results in the account

- * - * {@codesnippet com.azure.storage.file.directoryClient.listFilesAndDirectories} - * - * @param prefix Optional. Filters the results to return only files and directories whose name begins with the specified prefix. - * @param maxResults Optional. Specifies the maximum number of files and/or directories to return per page. - * If the request does not specify maxresults or specifies a value greater than 5,000, the server will return up to 5,000 items. - * @return {@link FileRef File info} in the storage account with prefix and max number of return results. - */ - public Iterable listFilesAndDirectories(String prefix, Integer maxResults) { - return directoryAsyncClient.listFilesAndDirectories(prefix, maxResults).toIterable(); - } - - /** - * List of open handles on a directory or a file. - * - *

Code Samples

- * - *

Get 10 handles with recursive call.

- * - *
-     * Iterable<HandleItem> result = client.getHandles(10, true)
-     * System.out.printf("Get handles completed with handle id %s", result.iterator().next().handleId());
-     * 
- * @param maxResult Optional. The number of results will return per page - * @param recursive Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. - * @return {@link HandleItem handles} in the directory that satisfy the requirements - */ - public Iterable getHandles(Integer maxResult, boolean recursive) { - return directoryAsyncClient.getHandles(maxResult, recursive).collectList().block(); - } - - /** - * Closes a handle or handles opened on a directory or a file at the service. It is intended to be used alongside {@link DirectoryClient#getHandles(Integer, boolean)} . - * - *

Code Samples

- * - *

Force close handles with handles returned by get handles in recursive.

- * - *
-     * Iterable<HandleItem> result = client.getHandles(10, true)
-     * result.forEach(handleItem ->  {
-     *    client.forceCloseHandles(handleItem.handleId, true).forEach(numOfClosedHandles ->
-     *    System.out.printf("Get handles completed with handle id %s", handleItem.handleId()));
-     * });
-     * 
- * @param handleId Specifies the handle ID to be closed. Use an asterisk ('*') as a wildcard string to specify all handles. - * @param recursive A boolean value that specifies if the operation should also apply to the files and subdirectories of the directory specified in the URI. - * @return The counts of number of handles closed. - */ - public Iterable forceCloseHandles(String handleId, boolean recursive) { - return directoryAsyncClient.forceCloseHandles(handleId, recursive).collectList().block(); - } - - /** - * Creates a subdirectory under current directory with specific name and returns a response of DirectoryClient to interact with it. - * - *

Code Samples

- * - *

Create the sub directory "subdir"

- * - *
-     * Response<DirectoryClient> response = client.createSubDirectory("subdir")
-     * System.out.printf("Creating the sub directory completed with status code %d", response.statusCode());
-     * 
- * - * @param subDirectoryName Name of the subdirectory - * @return A response containing the subdirectory client and the status of creating the directory. - * @throws StorageErrorException If the subdirectory has already existed, the parent directory does not exist or directory is an invalid resource name. - */ - public Response createSubDirectory(String subDirectoryName) { - return createSubDirectory(subDirectoryName, null); - } - - /** - * Creates a subdirectory under current directory with specific name , metadata and returns a response of DirectoryClient to interact with it. - * - *

Code Samples

- * - *

Create the subdirectory named "subdir", with metadata

- * - * com.azure.storage.file.directoryClient.createSubDirectory#string - * - * @param subDirectoryName Name of the subdirectory - * @param metadata Optional. Metadata to associate with the subdirectory - * @return A response containing the subdirectory client and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or subdirectory is an invalid resource name. - */ - public Response createSubDirectory(String subDirectoryName, Map metadata) { - return directoryAsyncClient.createSubDirectory(subDirectoryName, metadata).map(this::mapDirectoryAsyncResponse).block(); - } - - /** - * Deletes the subdirectory with specific name in the storage account. The directory must be empty before it can be deleted. - * - *

Code Samples

- * - *

Delete the subdirectory named "subdir"

- * - * {@codesnippet com.azure.storage.file.directoryClient.deleteSubDirectory#string} - * - * @param subDirectoryName Name of the subdirectory - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the subdirectory doesn't exist, the parent directory does not exist or subdirectory name is an invalid resource name. - */ - public VoidResponse deleteSubDirectory(String subDirectoryName) { - return directoryAsyncClient.deleteSubDirectory(subDirectoryName).block(); - } - - /** - * Creates a file in the storage account with specific name, max number of results and returns a response of DirectoryInfo to interact with it. - * - *

Code Samples

- * - *

Create 1k file with named "myFile"

- * - * {@codesnippet com.azure.storage.file.directoryClient.createFile#string-long} - * - * @param fileName Name of the file - * @param maxSize Size of the file - * @return A response containing the FileClient and the status of creating the directory. - * @throws StorageErrorException If the file has already existed, the parent directory does not exist or file name is an invalid resource name. - */ - public Response createFile(String fileName, long maxSize) { - return createFile(fileName, maxSize, null, null); - } - - /** - * Creates a file in the storage account with specific name and returns a response of DirectoryInfo to interact with it. - * - *

Code Samples

- * - *

Create the file named "myFile"

- * - *
-     * Response<FileClient> response = client.createFile("myFile", Collections.singletonMap("directory", "metadata"))
-     * System.out.printf("Creating the file completed with status code %d", response.statusCode());
-     * 
- * - * @param fileName Name of the file - * @param maxSize Max size of the file - * @param httpHeaders the Http headers set to the file - * @param metadata Optional. Name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. - * @return A response containing the directory info and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or file name is an invalid resource name. - */ - public Response createFile(String fileName, long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { - return directoryAsyncClient.createFile(fileName, maxSize, httpHeaders, metadata) - .map(response -> FileAsyncClient.mapResponse(response, new FileClient(response.value()))).block(); - } - - /** - * Deletes the file with specific name in the storage account. - * - *

Code Samples

- * - *

Delete the file "filetest"

- * - * {@codesnippet com.azure.storage.file.directoryClient.deleteFile#string} - * - * @param fileName Name of the file - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist or file name is an invalid resource name. - */ - public VoidResponse deleteFile(String fileName) { - return directoryAsyncClient.deleteFile(fileName).block(); - } - - private Response mapDirectoryAsyncResponse(Response response) { - DirectoryClient directoryClient = new DirectoryClient((DirectoryAsyncClient) response.value()); - return new SimpleResponse(response.request(), response.statusCode(), response.headers(), directoryClient); - } - -} diff --git a/storage/client/src/main/java/com/azure/storage/file/DirectoryClientBuilder.java b/storage/client/src/main/java/com/azure/storage/file/DirectoryClientBuilder.java deleted file mode 100644 index 7bf65af1537df..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/DirectoryClientBuilder.java +++ /dev/null @@ -1,346 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLoggingPolicy; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; -import com.azure.core.util.configuration.Configuration; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.storage.common.credentials.SASTokenCredential; -import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.common.policy.SASTokenCredentialPolicy; -import com.azure.storage.common.policy.SharedKeyCredentialPolicy; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link DirectoryClient FileClients} - * and {@link DirectoryAsyncClient FileAsyncClients}, calling {@link DirectoryClientBuilder#build() build} - * constructs an instance of FileClient and calling {@link DirectoryClientBuilder#buildAsync() buildAsync} - * constructs an instance of FileAsyncClient. - * - *

The client needs the endpoint of the Azure Storage File service, name of the share, and authorization credential. - * {@link DirectoryClientBuilder#endpoint(String) endpoint} gives the builder the endpoint and may give the builder the - * {@link DirectoryClientBuilder#shareName(String)}, {@link DirectoryClientBuilder#directoryName(String)} and a {@link SASTokenCredential} that authorizes the client.

- * - *

Instantiating a synchronous Directory Client with SAS token

- * {@codesnippet com.azure.storage.file.directoryClient.instantiation.sastoken} - * - *

Instantiating an Asynchronous Directory Client with SAS token

- * {@codesnippet com.azure.storage.file.directoryClient.instantiation.sastoken} - * - *
- * DirectoryClient client = DirectoryClient.builder()
- *     .endpoint(endpointWithSASTokenQueryParams)
- *     .build();
- * 
- * - *
- * DirectoryAsyncClient client = DirectoryAsyncClient.builder()
- *     .endpoint(endpointWithSASTokenQueryParams)
- *     .buildAsync();
- * 
- * - *

If the {@code endpoint} doesn't contain the query parameters to construct a {@code SASTokenCredential} they may - * be set using {@link DirectoryClientBuilder#credential(SASTokenCredential) credential}.

- * - * - *

Another way to authenticate the client is using a {@link SharedKeyCredential}. To create a SharedKeyCredential - * a connection string from the Storage File service must be used. Set the SharedKeyCredential with - * {@link DirectoryClientBuilder#connectionString(String) connectionString}. If the builder has both a SASTokenCredential and - * SharedKeyCredential the SharedKeyCredential will be preferred when authorizing requests sent to the service.

- * - *

Instantiating a synchronous Directory Client with connection string.

- * {@codesnippet com.azure.storage.file.directoryClient.instantiation.connectionstring} - * - *

Instantiating an Asynchronous Directory Client with connection string.

- * {@codesnippet com.azure.storage.file.directoryAsyncClient.instantiation.connectionstring} - * - * @see DirectoryClient - * @see DirectoryAsyncClient - * @see SASTokenCredential - * @see SharedKeyCredential - */ -public class DirectoryClientBuilder { - private static final String ACCOUNT_NAME = "AccountName".toLowerCase(); - private final List policies; - private final RetryPolicy retryPolicy; - - private HttpLogDetailLevel logLevel; - private Configuration configuration; - private URL endpoint; - private String shareName; - private String directoryName; - private SASTokenCredential sasTokenCredential; - private SharedKeyCredential sharedKeyCredential; - private HttpClient httpClient; - private HttpPipeline pipeline; - private String shareSnapshot; - - - DirectoryClientBuilder() { - retryPolicy = new RetryPolicy(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); - - configuration = ConfigurationManager.getConfiguration(); - } - - /** - * Creates a {@link DirectoryAsyncClient} based on options set in the builder. Every time {@code buildAsync()} is - * called a new instance of {@link DirectoryAsyncClient} is created. - * - *

- * If {@link DirectoryClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and - * {@link DirectoryClientBuilder#endpoint(String) endpoint} are used to create the - * {@link DirectoryAsyncClient client}. All other builder settings are ignored. - *

- * - * @return A ShareAsyncClient with the options set from the builder. - * @throws NullPointerException If {@code endpoint} or {@code shareName} is {@code null}. - * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. - */ - public DirectoryAsyncClient buildAsync() { - Objects.requireNonNull(endpoint); - - if (sasTokenCredential == null && sharedKeyCredential == null) { - throw new IllegalArgumentException("Credentials are required for authorization"); - } - - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - policies.add(new UserAgentPolicy(FileConfiguration.NAME, FileConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - - if (sharedKeyCredential != null) { - policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); - } else { - policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); - } - - HttpPolicyProviders.addBeforeRetryPolicies(policies); - - policies.add(retryPolicy); - - policies.addAll(this.policies); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(logLevel)); - - HttpPipeline pipeline = HttpPipeline.builder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); - - return new DirectoryAsyncClient(endpoint, pipeline, shareName, directoryName, shareSnapshot); - } - - /** - * Creates a {@link DirectoryClient} based on options set in the builder. Every time {@code build()} is - * called a new instance of {@link DirectoryClient} is created. - * - *

- * If {@link DirectoryClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and - * {@link DirectoryClientBuilder#endpoint(String) endpoint} are used to create the - * {@link DirectoryClient client}. All other builder settings are ignored. - *

- * - * @return A DirectoryClient with the options set from the builder. - * @throws NullPointerException If {@code endpoint}, {@code shareName} or {@code directoryName} is {@code null}. - * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. - */ - public DirectoryClient build() { - return new DirectoryClient(this.buildAsync()); - } - - /** - * Sets the endpoint for the Azure Storage File instance that the client will interact with. - * - *

The first path segment, if the endpoint contains path segments, will be assumed to be the name of the share - * that the client will interact with. Rest of the path segments should be the path of the directory.

- * - *

Query parameters of the endpoint will be parsed using {@link SASTokenCredential#(String) fromQuery} in an - * attempt to generate a {@link SASTokenCredential} to authenticate requests sent to the service.

- * - * @param endpoint The URL of the Azure Storage File instance to send service requests to and receive responses from. - * @return the updated DirectoryClientBuilder object - * @throws IllegalArgumentException If {@code endpoint} is {@code null} or is an invalid URL - */ - public DirectoryClientBuilder endpoint(String endpoint) { - Objects.requireNonNull(endpoint); - try { - URL fullURL = new URL(endpoint); - this.endpoint = new URL(fullURL.getProtocol() + "://" + fullURL.getHost()); - String[] pathSegments = fullURL.getPath().split("/"); - int length = pathSegments.length; - this.shareName = length >= 2 ? pathSegments[1] : this.shareName; - this.directoryName = length >= 3 ? pathSegments[2] : this.directoryName; - - // Attempt to get the SAS token from the URL passed - SASTokenCredential credential = SASTokenCredential.fromQuery(fullURL.getQuery()); - if (credential != null) { - this.sasTokenCredential = credential; - } - } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage Directory endpoint url is malformed."); - } - - return this; - } - - /** - * Sets the {@link SASTokenCredential} used to authenticate requests sent to the File service. - * - * @param credential SAS token credential generated from the Storage account that authorizes requests - * @return the updated DirectoryClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public DirectoryClientBuilder credential(SASTokenCredential credential) { - this.sasTokenCredential = credential; - return this; - } - - /** - * Creates a {@link SharedKeyCredential} from the {@code connectionString} used to authenticate requests sent to the - * File service. - * - * @param connectionString Connection string from the Access Keys section in the Storage account - * @return the updated DirectoryClientBuilder object - * @throws NullPointerException If {@code connectionString} is {@code null}. - */ - public DirectoryClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - this.sharedKeyCredential = SharedKeyCredential.fromConnectionString(connectionString); - getEndPointFromConnectionString(connectionString); - return this; - } - - private void getEndPointFromConnectionString(String connectionString) { - Map connectionStringPieces = new HashMap<>(); - for (String connectionStringPiece : connectionString.split(";")) { - String[] kvp = connectionStringPiece.split("=", 2); - connectionStringPieces.put(kvp[0].toLowerCase(), kvp[1]); - } - String accountName = connectionStringPieces.get(ACCOUNT_NAME); - try { - this.endpoint = new URL(String.format("https://%s.file.core.windows.net", accountName)); - } catch (MalformedURLException e) { - throw new IllegalArgumentException(String.format("There is no valid endpoint for the connection string. " + - "Connection String: %s", connectionString)); - } - } - - /** - * Sets the share that the constructed clients will interact with - * - * @param shareName Name of the share - * @return the updated DirectoryClientBuilder object - * @throws NullPointerException If {@code shareName} is {@code null}. - */ - public DirectoryClientBuilder shareName (String shareName) { - this.shareName = shareName; - return this; - } - - /** - * Sets the directory that the constructed clients will interact with - * - * @param directoryName Path to the directory - * @return the updated DirectoryClientBuilder object - * @throws NullPointerException If {@code directoryName} is {@code null}. - */ - public DirectoryClientBuilder directoryName(String directoryName) { - this.directoryName = directoryName; - return this; - } - - /** - * Sets the HTTP client to use for sending and receiving requests to and from the service. - * - * @param httpClient The HTTP client to use for requests. - * @return The updated DirectoryClientBuilder object. - * @throws NullPointerException If {@code httpClient} is {@code null}. - */ - public DirectoryClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /** - * Adds a policy to the set of existing policies that are executed after the {@link RetryPolicy}. - * - * @param pipelinePolicy The retry policy for service requests. - * @return The updated DirectoryClientBuilder object. - * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. - */ - public DirectoryClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - this.policies.add(pipelinePolicy); - return this; - } - - /** - * Sets the logging level for HTTP requests and responses. - * - * @param logLevel The amount of logging output when sending and receiving HTTP requests/responses. - * @return The updated DirectoryClientBuilder object. - */ - public DirectoryClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { - this.logLevel = logLevel; - return this; - } - - /** - * Sets the HTTP pipeline to use for the service client. - * - *

If {@code pipeline} is set, all other settings are ignored, aside from {@link DirectoryClientBuilder#endpoint(String) endpoint}, - * {@link DirectoryClientBuilder#shareName(String) shareName} @{link DirectoryClientBuilder#directoryName(String) filePath}, and {@link DirectoryClientBuilder#shareSnapshot(String) snaphotShot} - * when building clients.

- * - * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. - * @return The updated DirectoryClientBuilder object. - * @throws NullPointerException If {@code pipeline} is {@code null}. - */ - public DirectoryClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = Objects.requireNonNull(pipeline); - return this; - } - - /** - * Sets the configuration object used to retrieve environment configuration values used to build the client with - * when they are not set in the builder, defaults to Configuration.NONE - * @param configuration configuration store - * @return the updated DirectoryClientBuilder object - */ - public DirectoryClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /** - * Sets the snapshot that the constructed clients will interact with. This snapshot must be linked to the share - * that has been specified in the builder. - * - * @param shareSnapshot Identifier of the snapshot - * @return the updated DirectoryClientBuilder object - * @throws NullPointerException If {@code shareSnapshot} is {@code null}. - */ - public DirectoryClientBuilder shareSnapshot(String shareSnapshot) { - this.shareSnapshot = shareSnapshot; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/FileAsyncClient.java b/storage/client/src/main/java/com/azure/storage/file/FileAsyncClient.java deleted file mode 100644 index dc780bf2b24ba..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/FileAsyncClient.java +++ /dev/null @@ -1,789 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.http.rest.VoidResponse; -import com.azure.core.implementation.util.FluxUtil; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import com.azure.storage.common.credentials.SASTokenCredential; -import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.file.implementation.AzureFileStorageBuilder; -import com.azure.storage.file.implementation.AzureFileStorageImpl; -import com.azure.storage.file.models.CopyStatusType; -import com.azure.storage.file.models.FileCopyInfo; -import com.azure.storage.file.models.FileDownloadInfo; -import com.azure.storage.file.models.FileGetPropertiesHeaders; -import com.azure.storage.file.models.FileHTTPHeaders; -import com.azure.storage.file.models.FileInfo; -import com.azure.storage.file.models.FileMetadataInfo; -import com.azure.storage.file.models.FileProperties; -import com.azure.storage.file.models.FileRange; -import com.azure.storage.file.models.FileRangeWriteType; -import com.azure.storage.file.models.FileUploadInfo; -import com.azure.storage.file.models.FileUploadRangeHeaders; -import com.azure.storage.file.models.FilesCreateResponse; -import com.azure.storage.file.models.FilesDownloadResponse; -import com.azure.storage.file.models.FilesForceCloseHandlesResponse; -import com.azure.storage.file.models.FilesGetPropertiesResponse; -import com.azure.storage.file.models.FilesGetRangeListResponse; -import com.azure.storage.file.models.FilesListHandlesResponse; -import com.azure.storage.file.models.FilesSetHTTPHeadersResponse; -import com.azure.storage.file.models.FilesSetMetadataResponse; -import com.azure.storage.file.models.FilesStartCopyResponse; -import com.azure.storage.file.models.FilesUploadRangeResponse; -import com.azure.storage.file.models.HandleItem; -import com.azure.storage.file.models.StorageErrorException; -import io.netty.buffer.ByteBuf; -import java.io.File; -import java.io.IOException; -import java.io.UncheckedIOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.nio.channels.AsynchronousFileChannel; -import java.nio.file.Paths; -import java.nio.file.StandardOpenOption; -import java.time.Duration; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeoutException; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; -import reactor.core.scheduler.Schedulers; - -/** - * This class provides a client that contains all the operations for interacting with file in Azure Storage File Service. - * Operations allowed by the client are creating, copying, uploading, downloading, deleting and listing on a file, retrieving properties, setting metadata - * and list or force close handles of the file. - * - *

Instantiating an Asynchronous File Client

- * - *
- * FileAsyncClient client = FileAsyncClient.builder()
- *     .connectionString(connectionString)
- *     .endpoint(endpoint)
- *     .buildAsync();
- * 
- * - *

View {@link FileClientBuilder this} for additional ways to construct the client.

- * - * @see FileClientBuilder - * @see FileClient - * @see SharedKeyCredential - * @see SASTokenCredential - */ -public class FileAsyncClient { - private static final ClientLogger LOGGER = new ClientLogger(FileAsyncClient.class); - private static final long FILE_DEFAULT_BLOCK_SIZE = 4 * 1024 * 1024L; - - private final AzureFileStorageImpl azureFileStorageClient; - private final String shareName; - private final String filePath; - private final String shareSnapshot; - - /** - * Creates a FileAsyncClient that sends requests to the storage file at {@link AzureFileStorageImpl#url() endpoint}. - * Each service call goes through the {@link HttpPipeline pipeline} in the {@code client}. - * @param azureFileStorageClient Client that interacts with the service interfaces - * @param shareName Name of the share - * @param filePath Path to the file - * @param shareSnapshot The snapshot of the share - */ - FileAsyncClient(AzureFileStorageImpl azureFileStorageClient, String shareName, String filePath, String shareSnapshot) { - this.shareName = shareName; - this.filePath = filePath; - this.shareSnapshot = shareSnapshot; - this.azureFileStorageClient = new AzureFileStorageBuilder().pipeline(azureFileStorageClient.httpPipeline()) - .url(azureFileStorageClient.url()) - .version(azureFileStorageClient.version()) - .build(); - } - - /** - * Creates a FileAsyncClient that sends requests to the storage account at {@code endpoint}. - * Each service call goes through the {@code httpPipeline}. - * @param endpoint URL for the Storage File service - * @param httpPipeline HttpPipeline that HTTP requests and response flow through - * @param shareName Name of the share - * @param filePath Path to the file - * @param shareSnapshot Optional. The snapshot of the share - */ - FileAsyncClient(URL endpoint, HttpPipeline httpPipeline, String shareName, String filePath, String shareSnapshot) { - this.shareName = shareName; - this.filePath = filePath; - this.shareSnapshot = shareSnapshot; - this.azureFileStorageClient = new AzureFileStorageBuilder().pipeline(httpPipeline) - .url(endpoint.toString()) - .build(); - } - - /** - * Get the getFileUrl of the storage file client. - * @return the URL of the storage file client - * @throws MalformedURLException if no protocol is specified, or an - * unknown protocol is found, or {@code spec} is {@code null}. - */ - public URL getFileUrl() throws MalformedURLException { - return new URL(azureFileStorageClient.url()); - } - - /** - * Creates a builder that can configure options for the FileAsyncClient before creating an instance of it. - * - * @return A new {@link FileClientBuilder} used to create FileAsyncClient instances. - */ - public static FileClientBuilder builder() { - return new FileClientBuilder(); - } - - /** - * Creates a file in the storage account and returns a response of {@link FileInfo} to interact with it. - * - *

Code Samples

- * - *

Create the file with size 1KB.

- * - * {@codesnippet com.azure.storage.file.fileClient.create} - * - * @param maxSize The maximum size in bytes for the file, up to 1 TiB. - * @return A response containing the file info and the status of creating the file. - * @throws StorageErrorException If the file has already existed, the parent directory does not exist or fileName is an invalid resource name. - */ - public Mono> create(long maxSize) { - return create(maxSize, null, null); - } - - /** - * Creates a file in the storage account and returns a response of FileInfo to interact with it. - * - *

Code Samples

- * - *

Create the file with length of 1024 bytes, some headers and metadata.

- * - *
-     * FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain");
-     * client.create(1024, httpHeaders, Collections.singletonMap("file", "updatedMetadata"))
-     *     .subscribe(response -> System.out.printf("Creating the file completed with status code %d", response.statusCode()));
-     * 
- * - * @param maxSize The maximum size in bytes for the file, up to 1 TiB. - * @param httpHeaders Additional parameters for the operation. - * @param metadata Optional. Name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. - * @see C# identifiers - * @return A response containing the directory info and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory is an invalid resource name. - */ - public Mono> create(long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { - return azureFileStorageClient.files().createWithRestResponseAsync(shareName, filePath, maxSize, null, metadata, httpHeaders, Context.NONE) - .map(this::createResponse); - } - - /** - * Copies a blob or file to a destination file within the storage account. - * - *

Code Samples

- * - *

Copy file from source url to the {@code filePath}

- * - * {@codesnippet com.azure.storage.file.fileAsyncClient.startCopy#string-map} - * - * @param sourceUrl Specifies the URL of the source file or blob, up to 2 KB in length. - * @param metadata Optional. Name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. - * * @see C# identifiers - * @return A response containing the file copy info and the status of copying the file. - */ - public Mono> startCopy(String sourceUrl, Map metadata) { - return azureFileStorageClient.files().startCopyWithRestResponseAsync(shareName, filePath, sourceUrl, null, metadata, Context.NONE) - .map(this::startCopyResponse); - } - - /** - * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. - * - *

Code Samples

- * - *

Abort copy file from copy id("someCopyId")

- * - *
-     * client.abortCopy("someCopyId")
-     *     .subscribe(response -> System.out.printf("Abort copying the file completed with status code %d", response.statusCode()));
-     * 
- * - * @param copyId Specifies the copy id which has copying pending status associate with it. - * @return A response containing the status of aborting copy the file. - */ - public Mono abortCopy(String copyId) { - return azureFileStorageClient.files().abortCopyWithRestResponseAsync(shareName, filePath, copyId, Context.NONE) - .map(VoidResponse::new); - } - - /** - * Downloads a file from the system, including its metadata and properties - * - *

Code Samples

- * - *

Download the file to current folder.

- * - *
-     * client.downloadToFile("someFilePath")
-     *     .doOnTerminate(() -> if (Files.exist(Paths.get("someFilePath"))) {
-     *          System.out.println("Download the file completed");
-     *     });
-     * 
- * - * @param downloadFilePath The path where store the downloaded file - */ - public Mono downloadToFile(String downloadFilePath) { - return downloadToFile(downloadFilePath, null); - } - - /** - * Downloads a file from the system, including its metadata and properties - * - *

Code Samples

- * - *

Download the file from 1024 to 2048 bytes to current folder.

- * - * {@codesnippet com.azure.storage.file.fileAsyncClient.downloadToFile} - * - * @param downloadFilePath The path where store the downloaded file - * @param range Optional. Return file data only from the specified byte range. - */ - public Mono downloadToFile(String downloadFilePath, FileRange range) { - AsynchronousFileChannel channel; - try { - channel = AsynchronousFileChannel.open(Paths.get(downloadFilePath), StandardOpenOption.READ, StandardOpenOption.WRITE); - } catch (IOException e) { - return Mono.error(e); - } - return sliceFileRange(range) - .flatMap(chunk -> downloadWithProperties(chunk, false) - .map(dar -> dar.value().body()) - .subscribeOn(Schedulers.elastic()) - .flatMap(fbb -> FluxUtil.bytebufStreamToFile(fbb, channel, chunk.start() - (range == null ? 0 : range.start())) - .subscribeOn(Schedulers.elastic()) - .timeout(Duration.ofSeconds(300)) - .retry(3, throwable -> throwable instanceof IOException || throwable instanceof TimeoutException)) - .doOnTerminate(() -> - LOGGER.asInfo().log("Saved " + chunk.toString() + " on thread " + Thread.currentThread().getName()))) - .then() - .doOnTerminate(() -> { - try { - channel.close(); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - }); - } - - private Flux sliceFileRange(FileRange fileRange) { - long offset = fileRange == null ? 0L : fileRange.start(); - Mono end; - if (fileRange != null) { - end = Mono.just(fileRange.end()); - } else { - end = Mono.empty(); - } - end = end.switchIfEmpty(getProperties().map(rb -> rb.value().contentLength())); - return end - .map(e -> { - List chunks = new ArrayList<>(); - for (long pos = offset; pos < e; pos += FILE_DEFAULT_BLOCK_SIZE) { - long count = FILE_DEFAULT_BLOCK_SIZE; - if (pos + count > e) { - count = e - pos; - } - chunks.add(new FileRange(pos, pos + count - 1)); - } - return chunks; - }) - .flatMapMany(Flux::fromIterable); - } - - /** - * Downloads a file from the system, including its metadata and properties - * - *

Code Samples

- * - *

Download the file with its metadata and properties.

- * - * {@codesnippet com.azure.storage.file.fileAsyncClient.downloadWithProperties} - * - * @return A response that only contains headers and response status code - */ - public Mono> downloadWithProperties() { - return downloadWithProperties(null, null); - } - - /** - * Downloads a file from the system, including its metadata and properties - * - *

Code Samples

- * - *

Download the file from 1024 to 2048 bytes with its metadata and properties and without the contentMD5.

- * - *
-     * client.downloadWithProperties(new Range(1024, 2048), false)
-     *     .subscribe(response -> System.out.printf("Downloading the file range completed with status code %d", response.statusCode()));
-     * 
- * - * @param range Optional. Return file data only from the specified byte range. - * @param rangeGetContentMD5 Optional. When this header is set to true and specified together with the Range header, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size. - * @return A response that only contains headers and response status code - */ - public Mono> downloadWithProperties(FileRange range, Boolean rangeGetContentMD5) { - String rangeString = range == null ? null : range.toString(); - return azureFileStorageClient.files().downloadWithRestResponseAsync(shareName, filePath, null, rangeString, rangeGetContentMD5, Context.NONE) - .map(this::downloadWithPropertiesResponse); - } - - /** - * Deletes the file associate with the client. - * - *

Code Samples

- * - *

Delete the file

- * - * {@codesnippet com.azure.storage.file.fileAsyncClient.delete} - * - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist. - */ - public Mono delete() { - return azureFileStorageClient.files().deleteWithRestResponseAsync(shareName, filePath, Context.NONE) - .map(VoidResponse::new); - } - - /** - * Retrieves the properties of the storage account's file. - * The properties includes file metadata, last modified date, is server encrypted, and eTag. - * - *

Code Samples

- * - *

Retrieve file properties

- * - *
-     * client.getProperties()
-     *    .subscribe(response -> {
-     *        DirectoryProperties properties = response.value();
-     *        System.out.printf("File latest modified date is %s.", properties.lastModified());
-     *    });
-     * 
- * - * @return Storage file properties - */ - public Mono> getProperties() { - return azureFileStorageClient.files().getPropertiesWithRestResponseAsync(shareName, filePath, shareSnapshot, null, Context.NONE) - .map(this::getPropertiesResponse); - } - - /** - * Sets the user-defined httpHeaders to associate to the file. - * - *

If {@code null} is passed for the httpHeaders it will clear the httpHeaders associated to the file.

- * - *

Code Samples

- * - *

Set the httpHeaders of contentType of "text/plain"

- * - *
-     * FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain");
-     * client.setHttpHeaders(1024, httpHeaders)
-     *     .subscribe(response -> System.out.printf("Setting the file httpHeaders completed with status code %d", response.statusCode()));
-     * 
- * - *

Clear the metadata of the file

- * - *
-     * client.setHttpHeaders(1024, null)
-     *     .subscribe(response -> System.out.printf("Clearing the file httpHeaders completed with status code %d", response.statusCode()));
-     * 
- * - * @param newFileSize New file size of the file - * @param httpHeaders Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are cleared. - * @return Response of the information about the file - * @throws IllegalArgumentException thrown if parameters fail the validation. - */ - public Mono> setHttpHeaders(long newFileSize, FileHTTPHeaders httpHeaders) { - return azureFileStorageClient.files().setHTTPHeadersWithRestResponseAsync(shareName, filePath, null, newFileSize, httpHeaders, Context.NONE) - .map(this::setHttpHeadersResponse); - } - - /** - * Sets the user-defined metadata to associate to the file. - * - *

If {@code null} is passed for the metadata it will clear the metadata associated to the file.

- * - *

Code Samples

- * - *

Set the metadata to "file:updatedMetadata"

- * - *
-     * client.setMetadata(Collections.singletonMap("file", "updatedMetadata"))
-     *     .subscribe(response -> System.out.printf("Setting the file metadata completed with status code %d", response.statusCode()));
-     * 
- * - *

Clear the metadata of the file

- * - *
-     * client.setMetadata(null)
-     *     .subscribe(response -> System.out.printf("Clearing the file metadata completed with status code %d", response.statusCode()));
-     * 
- * - * @param metadata Options.Metadata to set on the file, if null is passed the metadata for the file is cleared - * @return information about the file - * @throws StorageErrorException If the file doesn't exist or the metadata contains invalid keys - */ - public Mono> setMetadata(Map metadata) { - return azureFileStorageClient.files().setMetadataWithRestResponseAsync(shareName, filePath, null, metadata, Context.NONE) - .map(this::setMeatadataResponse); - } - - /** - * Uploads a range of bytes to the beginning of a file in storage file service. Upload operations performs an in-place write on the specified file. - * - *

Code Samples

- * - *

Upload "default" to the file.

- * - * {@codesnippet com.azure.storage.file.fileAsyncClient.upload} - * - * @param data The data which will upload to the storage file. - * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero.. - * @return A response that only contains headers and response status code - * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) - */ - public Mono> upload(Flux data, long length) { - FileRange range = new FileRange(0, length - 1); - return azureFileStorageClient.files().uploadRangeWithRestResponseAsync(shareName, filePath, range.toString(), FileRangeWriteType.UPDATE, length, data, null, null, Context.NONE) - .map(this::uploadResponse); - } - - /** - * Uploads a range of bytes to specific of a file in storage file service. Upload operations performs an in-place write on the specified file. - * - *

Code Samples

- * - *

Upload the file from 1024 to 2048 bytes with its metadata and properties and without the contentMD5.

- * - *
-     * ByteBuf defaultData = Unpooled.wrappedBuffer(defaultText.getBytes(StandardCharsets.UTF_8));
-     * client.upload(defaultData, defaultData.readableBytes())
-     *     .subscribe(response -> System.out.printf("Upload the bytes to file range completed with status code %d", response.statusCode()));
-     * 
- * - * @param data The data which will upload to the storage file. - * @param offset Optional. The starting point of the upload range. It will start from the beginning if it is {@code null} - * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero. - * @param type You may specify one of the following options: - * - Update: Writes the bytes specified by the request body into the specified range. - * - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero. - * @return A response that only contains headers and response status code - * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) - */ - public Mono> upload(Flux data, long length, long offset, FileRangeWriteType type) { - FileRange range = new FileRange(offset, offset + length - 1); - return azureFileStorageClient.files().uploadRangeWithRestResponseAsync(shareName, filePath, range.toString(), type, length, data, null, null, Context.NONE) - .map(this::uploadResponse); - } - - /** - * Uploads file to storage file service. - * - *

Code Samples

- * - *

Upload the file from the source file path.

- * - * {@codesnippet com.azure.storage.file.fileAsyncClient.uploadFromFile} - * - * @param uploadFilePath The path where store the source file to upload - */ - public Mono uploadFromFile(String uploadFilePath) { - return uploadFromFile(uploadFilePath, FileRangeWriteType.UPDATE); - } - - /** - * Uploads file to storage file service. - * - *

Code Samples

- * - *

Upload the file from the source file path.

- * - *
-     * client.uploadFromFile("someFilePath", FileRangeWriteType.UPDATE)
-     *     .doOnTerminate(() -> if (client.getProperties() != null) {
-     *          System.out.printf("Upload the file with length of %d completed", client.getProperties().block().value().contentLength());
-     *     });
-     * 
- * - * @param uploadFilePath The path where store the source file to upload - * @param type You may specify one of the following options: - * - Update: Writes the bytes specified by the request body into the specified range. - * - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero. - */ - public Mono uploadFromFile(String uploadFilePath, FileRangeWriteType type) { - AsynchronousFileChannel channel; - try { - channel = AsynchronousFileChannel.open(Paths.get(uploadFilePath), StandardOpenOption.READ); - } catch (IOException e) { - return Mono.error(e); - } - return Flux.fromIterable(sliceFile(uploadFilePath)) - .flatMap(chunk -> { - return upload(FluxUtil.byteBufStreamFromFile(channel, chunk.start(), chunk.end() - chunk.start() + 1), chunk.end() - chunk.start() + 1, chunk.start(), type) - .timeout(Duration.ofSeconds(300)) - .retry(3, throwable -> throwable instanceof IOException || throwable instanceof TimeoutException); - }) - .then() - .doOnTerminate(() -> { - try { - channel.close(); - } catch (IOException e) { - throw new UncheckedIOException(e); - } - }); - } - - private List sliceFile(String path) { - File file = new File(path); - assert file.exists(); - List ranges = new ArrayList<>(); - for (long pos = 0; pos < file.length(); pos += FILE_DEFAULT_BLOCK_SIZE) { - long count = FILE_DEFAULT_BLOCK_SIZE; - if (pos + count > file.length()) { - count = file.length() - pos; - } - ranges.add(new FileRange(pos, pos + count - 1)); - } - return ranges; - } - - /** - * List of valid ranges for a file. - * - *

Code Samples

- * - *

List all ranges for the file client.

- * - *
-     * client.listRanges()
-     *     .subscribe(range -> System.out.printf("List ranges completed with start: %d, end: %d", range.start(), range.end()));
-     * 
- * - * @return {@link FileRange ranges} in the files. - */ - public Flux listRanges() { - return azureFileStorageClient.files().getRangeListWithRestResponseAsync(shareName, filePath, shareSnapshot, null, null, Context.NONE) - .flatMapMany(this::convertListRangesResponseToFileRangeInfo); - } - - /** - * List of valid ranges for a file. - * - *

Code Samples

- * - *

List all ranges within the file range from 1KB to 2KB.

- * - *
-     * client.listRanges(new FileRange(1024, 2048)
-     *     .subscribe(result -> System.out.printf("List ranges completed with start: %d, end: %d", result.start(), result.end()));
-     * 
- * - * @param range Optional. Return file data only from the specified byte range. - * @return {@link FileRange ranges} in the files that satisfy the requirements - */ - public Flux listRanges(FileRange range) { - return azureFileStorageClient.files().getRangeListWithRestResponseAsync(shareName, filePath, shareSnapshot, null, range.toString(), Context.NONE) - .flatMapMany(this::convertListRangesResponseToFileRangeInfo); - } - - /** - * List of open handles on a file. - * - *

Code Samples

- * - *

List all handles for the file client.

- * - *
-     * client.listHandles()
-     *     .subscribe(result -> System.out.printf("List handles completed with handle id %s", result.handleId()));
-     * 
- * - * @return {@link HandleItem handles} in the files that satisfy the requirements - */ - public Flux listHandles() { - return listHandles(null); - } - - /** - * List of open handles on a file. - * - *

Code Samples

- * - *

List 10 handles for the file client.

- * - *
-     * client.listHandles(10)
-     *     .subscribe(result -> System.out.printf("List handles completed with handle id %s", result.handleId()));     * 
- * @param maxResults Optional. The number of results will return per page - * @return {@link HandleItem handles} in the file that satisfy the requirements - */ - public Flux listHandles(Integer maxResults) { - return azureFileStorageClient.files().listHandlesWithRestResponseAsync(shareName, filePath, null, maxResults, null, shareSnapshot, Context.NONE) - .flatMapMany(response -> nextPageForHandles(response, maxResults)); - } - - /** - * Closes a handle or handles opened on a file at the service. It is intended to be used alongside {@link FileAsyncClient#listHandles()} (Integer)} . - * - *

Code Samples

- * - *

Force close handles with handles returned by list handles in recursive.

- * - *
-     * client.listHandles(10)
-     *     .subscribe(result -> {
-     *         client.forceCloseHandles(result.handleId(), true).subscribe(numOfClosedHandles ->
-     *              System.out.printf("Close %d handles.", numOfClosedHandles)
-     *     )});
-     * 
- * @param handleId Specifies the handle ID to be closed. Use an asterisk ('*') as a wildcard string to specify all handles. - * @return The counts of number of handles closed - */ - public Flux forceCloseHandles(String handleId) { - return azureFileStorageClient.files().forceCloseHandlesWithRestResponseAsync(shareName, filePath, handleId, null, null, shareSnapshot, Context.NONE) - .flatMapMany(response -> nextPageForForceCloseHandles(response, handleId)); - } - - private Flux nextPageForForceCloseHandles(final FilesForceCloseHandlesResponse response, final String handleId) { - List handleCount = Arrays.asList(response.deserializedHeaders().numberOfHandlesClosed()); - - if (response.deserializedHeaders().marker() == null) { - return Flux.fromIterable(handleCount); - } - Mono listResponse = azureFileStorageClient.files().forceCloseHandlesWithRestResponseAsync(shareName, filePath, handleId, null, response.deserializedHeaders().marker(), shareSnapshot, Context.NONE); - Flux fileRefPublisher = listResponse.flatMapMany(newResponse -> nextPageForForceCloseHandles(newResponse, handleId)); - return Flux.fromIterable(handleCount).concatWith(fileRefPublisher); - } - - private Flux nextPageForHandles(final FilesListHandlesResponse response, final Integer maxResults) { - List handleItems = response.value().handleList(); - - if (response.value().nextMarker() == null) { - return Flux.fromIterable(handleItems); - } - - Mono listResponse = azureFileStorageClient.files().listHandlesWithRestResponseAsync(shareName, filePath, response.value().nextMarker(), maxResults, null, shareSnapshot, Context.NONE); - Flux fileRefPublisher = listResponse.flatMapMany(newResponse -> nextPageForHandles(newResponse, maxResults)); - return Flux.fromIterable(handleItems).concatWith(fileRefPublisher); - } - - private Response createResponse(final FilesCreateResponse response) { - String eTag = response.deserializedHeaders().eTag(); - OffsetDateTime lastModified = response.deserializedHeaders().lastModified(); - boolean isServerEncrypted = response.deserializedHeaders().isServerEncrypted(); - FileInfo fileInfo = new FileInfo(eTag, lastModified, isServerEncrypted); - return mapResponse(response, fileInfo); - } - - private Response startCopyResponse(final FilesStartCopyResponse response) { - String eTag = response.deserializedHeaders().eTag(); - OffsetDateTime lastModified = response.deserializedHeaders().lastModified(); - String copyId = response.deserializedHeaders().copyId(); - CopyStatusType copyStatus = response.deserializedHeaders().copyStatus(); - FileCopyInfo fileCopyInfo = new FileCopyInfo(eTag, lastModified, copyId, copyStatus); - return mapResponse(response, fileCopyInfo); - } - - private Response setHttpHeadersResponse(final FilesSetHTTPHeadersResponse response) { - String eTag = response.deserializedHeaders().eTag(); - OffsetDateTime lastModified = response.deserializedHeaders().lastModified(); - boolean isServerEncrypted = response.deserializedHeaders().isServerEncrypted(); - FileInfo fileInfo = new FileInfo(eTag, lastModified, isServerEncrypted); - return mapResponse(response, fileInfo); - } - private Response downloadWithPropertiesResponse(final FilesDownloadResponse response) { - String eTag = response.deserializedHeaders().eTag(); - OffsetDateTime lastModified = response.deserializedHeaders().lastModified(); - Map metadata = response.deserializedHeaders().metadata(); - Long contentLength = response.deserializedHeaders().contentLength(); - String contentType = response.deserializedHeaders().contentType(); - String contentRange = response.deserializedHeaders().contentRange(); - Flux body = response.value(); - FileDownloadInfo fileDownloadInfo = new FileDownloadInfo(eTag, lastModified, metadata, contentLength, contentType, contentRange, body); - return mapResponse(response, fileDownloadInfo); - } - - private Response getPropertiesResponse(final FilesGetPropertiesResponse response) { - FileGetPropertiesHeaders headers = response.deserializedHeaders(); - String eTag = headers.eTag(); - OffsetDateTime lastModified = headers.lastModified(); - Map metadata = headers.metadata(); - String fileType = headers.fileType(); - Long contentLength = headers.contentLength(); - String contentType = headers.contentType(); - byte[] contentMD5; - try { - contentMD5 = headers.contentMD5(); - } catch (NullPointerException e) { - contentMD5 = null; - } - String contentEncoding = headers.contentEncoding(); - String cacheControl = headers.cacheControl(); - String contentDisposition = headers.contentDisposition(); - OffsetDateTime copyCompletionTime = headers.copyCompletionTime(); - String copyStatusDescription = headers.copyStatusDescription(); - String copyId = headers.copyId(); - String copyProgress = headers.copyProgress(); - String copySource = headers.copySource(); - CopyStatusType copyStatus = headers.copyStatus(); - Boolean isServerEncrpted = headers.isServerEncrypted(); - FileProperties fileProperties = new FileProperties(eTag, lastModified, metadata, fileType, contentLength, - contentType, contentMD5, contentEncoding, cacheControl, contentDisposition, copyCompletionTime, copyStatusDescription, - copyId, copyProgress, copySource, copyStatus, isServerEncrpted); - return mapResponse(response, fileProperties); - } - - private Response uploadResponse(final FilesUploadRangeResponse response) { - FileUploadRangeHeaders headers = response.deserializedHeaders(); - String eTag = headers.eTag(); - OffsetDateTime lastModified = headers.lastModified(); - byte[] contentMD5; - try { - contentMD5 = headers.contentMD5(); - } catch (NullPointerException e) { - contentMD5 = null; - } - Boolean isServerEncrypted = headers.isServerEncrypted(); - FileUploadInfo fileUploadInfo = new FileUploadInfo(eTag, lastModified, contentMD5, isServerEncrypted); - return mapResponse(response, fileUploadInfo); - } - - private Response setMeatadataResponse(final FilesSetMetadataResponse response) { - String eTag = response.deserializedHeaders().eTag(); - boolean isServerEncrypted = response.deserializedHeaders().isServerEncrypted(); - FileMetadataInfo fileMetadataInfo = new FileMetadataInfo(eTag, isServerEncrypted); - return mapResponse(response, fileMetadataInfo); - } - - private Flux convertListRangesResponseToFileRangeInfo(FilesGetRangeListResponse response) { - List fileRanges = new ArrayList<>(); - response.value().forEach(range -> { - long start = range.start(); - long end = range.end(); - fileRanges.add(new FileRange(start, end)); - }); - return Flux.fromIterable(fileRanges); - } - - static SimpleResponse mapResponse(Response response, T value) { - return new SimpleResponse<>(response.request(), response.statusCode(), response.headers(), value); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/FileClient.java b/storage/client/src/main/java/com/azure/storage/file/FileClient.java deleted file mode 100644 index ccaa760e31254..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/FileClient.java +++ /dev/null @@ -1,501 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.VoidResponse; -import com.azure.storage.common.credentials.SASTokenCredential; -import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.file.models.FileCopyInfo; -import com.azure.storage.file.models.FileDownloadInfo; -import com.azure.storage.file.models.FileHTTPHeaders; -import com.azure.storage.file.models.FileInfo; -import com.azure.storage.file.models.FileMetadataInfo; -import com.azure.storage.file.models.FileProperties; -import com.azure.storage.file.models.FileRange; -import com.azure.storage.file.models.FileRangeWriteType; -import com.azure.storage.file.models.FileUploadInfo; -import com.azure.storage.file.models.HandleItem; -import com.azure.storage.file.models.StorageErrorException; -import io.netty.buffer.ByteBuf; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Map; -import reactor.core.publisher.Flux; - -/** - * This class provides a client that contains all the operations for interacting files under Azure Storage File Service. - * Operations allowed by the client are creating, uploading, copying, listing, downloading, and deleting files. - * - *

Instantiating a synchronous File Client

- * - *
- * FileClient client = FileClient.builder()
- *        .connectionString(connectionString)
- *        .endpoint(endpoint)
- *        .build();
- * 
- * - *

View {@link FileClientBuilder this} for additional ways to construct the client.

- * - * @see FileClientBuilder - * @see FileAsyncClient - * @see SharedKeyCredential - * @see SASTokenCredential - */ -public class FileClient { - private final FileAsyncClient fileAsyncClient; - - /** - * Creates a FileClient that wraps a FileAsyncClient and blocks requests. - * - * @param fileAsyncClient FileAsyncClient that is used to send requests - */ - FileClient(FileAsyncClient fileAsyncClient) { - this.fileAsyncClient = fileAsyncClient; - } - - /** - * Get the getFileUrl of the storage file client. - * @return the URL of the storage file client - * @throws MalformedURLException if no protocol is specified, or an - * unknown protocol is found, or {@code spec} is {@code null}. - */ - public URL getFileUrl() throws MalformedURLException { - return fileAsyncClient.getFileUrl(); - } - - /** - * Creates a builder that can configure options for the FileClient before creating an instance of it. - * - * @return A new {@link FileClientBuilder} to create a ConfigurationClient. - */ - public static FileClientBuilder builder() { - return new FileClientBuilder(); - } - - /** - * Creates a file in the storage account and returns a response of {@link FileInfo} to interact with it. - * - *

Code Samples

- * - *

Create the file with length of 1024 bytes, some headers and metadata.

- * - * {@codesnippet com.azure.storage.file.fileClient.create} - * - * @param maxSize The maximum size in bytes for the file, up to 1 TiB. - * @return A response containing the file info and the status of creating the file. - * @throws StorageErrorException If the file has already existed, the parent directory does not exist or fileName is an invalid resource name. - */ - public Response create(long maxSize) { - return fileAsyncClient.create(maxSize).block(); - } - - /** - * Creates a file in the storage account and returns a response of FileInfo to interact with it. - * - *

Code Samples

- * - *

Create the file with length of 1024 bytes, some headers and metadata.

- * - *
-     * FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain");
-     * Response<FileInfo> response = client.create(1024, httpHeaders, Collections.singletonMap("file", "updatedMetadata"));
-     * System.out.printf("Creating the file completed with status code %d", response.statusCode());
-     * 
- * - * @param maxSize The maximum size in bytes for the file, up to 1 TiB. - * @param httpHeaders Additional parameters for the operation. - * @param metadata Optional. Name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. - * @see C# identifiers - * @return A response containing the directory info and the status of creating the directory. - * @throws StorageErrorException If the directory has already existed, the parent directory does not exist or directory is an invalid resource name. - */ - public Response create(long maxSize, FileHTTPHeaders httpHeaders, Map metadata) { - return fileAsyncClient.create(maxSize, httpHeaders, metadata).block(); - } - - /** - * Copies a blob or file to a destination file within the storage account. - * - *

Code Samples

- * - *

Copy file from source getDirectoryUrl to the {@code filePath}

- * - * {@codesnippet com.azure.storage.file.fileClient.startCopy#string-map} - * - * @param sourceUrl Specifies the URL of the source file or blob, up to 2 KB in length. - * @param metadata Optional. Name-value pairs associated with the file as metadata. Metadata names must adhere to the naming rules. - * * @see C# identifiers - * @return A response containing the file copy info and the status of copying the file. - */ - public Response startCopy(String sourceUrl, Map metadata) { - return fileAsyncClient.startCopy(sourceUrl, metadata).block(); - } - - /** - * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. - * - *

Code Samples

- * - *

Abort copy file from copy id("someCopyId")

- * - *
-     * VoidResponse response = client.abortCopy("someCopyId")
-     * System.out.printf("Abort copying the file completed with status code %d", response.statusCode());
-     * 
- * - * @param copyId Specifies the copy id which has copying pending status associate with it. - * @return A response containing the status of aborting copy the file. - */ - public VoidResponse abortCopy(String copyId) { - return fileAsyncClient.abortCopy(copyId).block(); - } - - /** - * Downloads a file from the system, including its metadata and properties - * - *

Code Samples

- * - *

Download the file to current folder.

- * - * {@codesnippet com.azure.storage.file.fileClient.downloadToFile} - * - * @param downloadFilePath The path where store the downloaded file - */ - public void downloadToFile(String downloadFilePath) { - downloadToFile(downloadFilePath, null); - } - - /** - * Downloads a file from the system, including its metadata and properties - * - *

Code Samples

- * - *

Download the file from 1024 to 2048 bytes to current folder.

- * - *
-     * client.downloadToFile("someFilePath", new FileRange(1024, 2048));
-     * if (Files.exist(Paths.get(downloadFilePath))) {
-     *      System.out.println("Download the file completed");
-     * }
-     * 
- * - * @param downloadFilePath The path where store the downloaded file - * @param range Optional. Return file data only from the specified byte range. - */ - public void downloadToFile(String downloadFilePath, FileRange range) { - fileAsyncClient.downloadToFile(downloadFilePath, range).block(); - } - - /** - * Downloads a file from the system, including its metadata and properties - * - *

Code Samples

- * - *

Download the file with its metadata and properties.

- * - * {@codesnippet com.azure.storage.file.fileClient.downloadWithProperties} - * - * @return A response that only contains headers and response status code - */ - public Response downloadWithProperties() { - return fileAsyncClient.downloadWithProperties(null, null).block(); - } - - /** - * Downloads a file from the system, including its metadata and properties - * - *

Code Samples

- * - *

Download the file from 1024 to 2048 bytes with its metadata and properties and without the contentMD5.

- * - *
-     * Response<FileDownloadInfo> response = client.downloadWithProperties()
-     * System.out.printf("Downloading the file completed with status code %d", response.statusCode());
-     * 
- * - * @param range Optional. Return file data only from the specified byte range. - * @param rangeGetContentMD5 Optional. When this header is set to true and specified together with the Range header, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size. - * @return A response that only contains headers and response status code - */ - public Response downloadWithProperties(FileRange range, Boolean rangeGetContentMD5) { - return fileAsyncClient.downloadWithProperties(range, rangeGetContentMD5).block(); - } - - /** - * Deletes the file associate with the client. - * - *

Code Samples

- * - *

Delete the file

- * - * {@codesnippet com.azure.storage.file.fileClient.delete} - * - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the directory doesn't exist or the file doesn't exist. - */ - public VoidResponse delete() { - return fileAsyncClient.delete().block(); - } - - /** - * Retrieves the properties of the storage account's file. - * The properties includes file metadata, last modified date, is server encrypted, and eTag. - * - *

Code Samples

- * - *

Retrieve file properties

- * - *
-     * Response<FileProperties> response = client.getProperties()
-     * DirectoryProperties properties = response.value();
-     * System.out.printf("File latest modified date is %s.", properties.lastModified());
-     * 
- * - * @return Storage file properties - */ - public Response getProperties() { - return fileAsyncClient.getProperties().block(); - } - - /** - * Sets the user-defined httpHeaders to associate to the file. - * - *

If {@code null} is passed for the httpHeaders it will clear the httpHeaders associated to the file.

- * - *

Code Samples

- * - *

Set the httpHeaders of contentType of "text/plain"

- * - *
-     * FileHTTPHeaders httpHeaders = new FileHTTPHeaders().fileContentType("text/plain");
-     * Response<FileInfo> response = client.setHttpHeaders(1024, httpHeaders);
-     * System.out.printf("Setting the file httpHeaders completed with status code %d", response.statusCode());
-     * 
- * - *

Clear the metadata of the file

- * - *
-     * Response<FileInfo> response = client.setHttpHeaders(1024, null)
-     * System.out.printf("Clearing the file httpHeaders completed with status code %d", response.statusCode());
-     * 
- * - * @param newFileSize New file size of the file - * @param httpHeaders Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are cleared. - * @return Response of the information about the file - * @throws IllegalArgumentException thrown if parameters fail the validation. - */ - public Response setHttpHeaders(long newFileSize, FileHTTPHeaders httpHeaders) { - return fileAsyncClient.setHttpHeaders(newFileSize, httpHeaders).block(); - } - - /** - * Sets the user-defined metadata to associate to the file. - * - *

If {@code null} is passed for the metadata it will clear the metadata associated to the file.

- * - *

Code Samples

- * - *

Set the metadata to "file:updatedMetadata"

- * - *
-     * Response<FileMetadataInfo> response = client.setMetadata(Collections.singletonMap("file", "updatedMetadata"));
-     * System.out.printf("Setting the file metadata completed with status code %d", response.statusCode());
-     * 
- * - *

Clear the metadata of the file

- * - *
-     * client.setMetadata(null)
-     *     .subscribe(response -> System.out.printf("Clearing the file metadata completed with status code %d", response.statusCode()));
-     * 
- * - * @param metadata Options.Metadata to set on the file, if null is passed the metadata for the file is cleared - * @return information about the file - * @throws StorageErrorException If the file doesn't exist or the metadata contains invalid keys - */ - public Response setMeatadata(Map metadata) { - return fileAsyncClient.setMetadata(metadata).block(); - } - - /** - * Uploads a range of bytes to the beginning of a file in storage file service. Upload operations performs an in-place write on the specified file. - * - *

Code Samples

- * - *

Upload "default" to the file.

- * - * {@codesnippet com.azure.storage.file.fileClient.upload} - * - * @param data The data which will upload to the storage file. - * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero.. - * @return A response that only contains headers and response status code - * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) - */ - public Response upload(ByteBuf data, long length) { - return fileAsyncClient.upload(Flux.just(data), length).block(); - } - - /** - * Uploads a range of bytes to specific of a file in storage file service. Upload operations performs an in-place write on the specified file. - * - *

Code Samples

- * - *

Upload the file from 1024 to 2048 bytes with its metadata and properties and without the contentMD5.

- * - *
-     * ByteBuf defaultData = Unpooled.wrappedBuffer("default".getBytes(StandardCharsets.UTF_8));
-     * Response<FileUploadInfo> response = client.upload(defaultData, defaultData.readableBytes());
-     * System.out.printf("Upload the bytes to file range completed with status code %d", response.statusCode());
-     * 
- * - * @param data The data which will upload to the storage file. - * @param offset Optional. The starting point of the upload range. It will start from the beginning if it is {@code null} - * @param length Specifies the number of bytes being transmitted in the request body. When the FileRangeWriteType is set to clear, the value of this header must be set to zero. - * @param type You may specify one of the following options: - * - Update: Writes the bytes specified by the request body into the specified range. - * - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero. - * @return A response that only contains headers and response status code - * @throws StorageErrorException If you attempt to upload a range that is larger than 4 MB, the service returns status code 413 (Request Entity Too Large) - */ - public Response upload(ByteBuf data, long length, int offset, FileRangeWriteType type) { - return fileAsyncClient.upload(Flux.just(data), length, offset, type).block(); - } - - /** - * Uploads file to storage file service. - * - *

Code Samples

- * - *

Upload the file from the source file path.

- * - * {@codesnippet com.azure.storage.file.fileClient.uploadFromFile} - * - * @param uploadFilePath The path where store the source file to upload - */ - public void uploadFromFile(String uploadFilePath) { - uploadFromFile(uploadFilePath, FileRangeWriteType.UPDATE); - } - - /** - * Uploads file to storage file service. - * - *

Code Samples

- * - *

Upload the file from the source file path.

- * - *
-     * client.uploadFromFile("someFilePath", FileRangeWriteType.UPDATE);
-     * if (client.getProperties() != null) {
-     *     System.out.printf("Upload the file with length of %d completed", client.getProperties().block().value().contentLength());
-     * };
-     * 
- * - * @param uploadFilePath The path where store the source file to upload - * @param type You may specify one of the following options: - * - Update: Writes the bytes specified by the request body into the specified range. - * - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero. - */ - public void uploadFromFile(String uploadFilePath, FileRangeWriteType type) { - fileAsyncClient.uploadFromFile(uploadFilePath, type).block(); - } - - /** - * List of valid ranges for a file. - * - *

Code Samples

- * - *

List all ranges for the file client.

- * - *
-     * Iterable<FileRange> ranges = client.listRanges();
-     * ranges.forEach(range ->
-     *      System.out.printf("List ranges completed with start: %d, end: %d", range.start(), range.end()));
-     * 
- * - * @return {@link FileRange ranges} in the files. - */ - public Iterable listRanges() { - return fileAsyncClient.listRanges(null).toIterable(); - } - - /** - * List of valid ranges for a file. - * - *

Code Samples

- * - *

List all ranges within the file range from 1KB to 2KB.

- * - *
-     * Iterable%lt;FileRange> ranges = client.listRanges(new FileRange(1024, 2048));
-     * ranges.forEach(range ->
-     *      System.out.printf("List ranges completed with start: %d, end: %d", range.start(), range.end()));
-     * 
- * - * @param range Optional. Return file data only from the specified byte range. - * @return {@link FileRange ranges} in the files that satisfy the requirements - */ - public Iterable listRanges(FileRange range) { - return fileAsyncClient.listRanges(range).toIterable(); - } - - /** - * List of open handles on a file. - * - *

Code Samples

- * - *

List all handles for the file client.

- * - *
-     * client.listHandles()
-     *     .forEach(handleItem -> System.out.printf("List handles completed with handleId %d", handleItem.handleId()));
-     * 
- * - * @return {@link HandleItem handles} in the files that satisfy the requirements - */ - public Iterable listHandles() { - return listHandles(null); - } - - /** - * List of open handles on a file. - * - *

Code Samples

- * - *

List 10 handles for the file client.

- * - *
-     * client.listHandles(10)
-     *     .forEach(handleItem -> System.out.printf("List handles completed with handleId %d", handleItem.handleId()));
-     * 
- * @param maxResults Optional. The number of results will return per page - * @return {@link HandleItem handles} in the file that satisfy the requirements - */ - public Iterable listHandles(Integer maxResults) { - return fileAsyncClient.listHandles(maxResults).toIterable(); - } - - /** - * Closes a handle or handles opened on a file at the service. It is intended to be used alongside {@link FileClient#listHandles()} (Integer)} . - * - *

Code Samples

- * - *

Force close handles with handles returned by list handles in recursive.

- * - *
-     * client.listHandles(10)
-     *     .forEach(result -> {
-     *         client.forceCloseHandles(result.handleId(), true).subscribe(numOfClosedHandles ->
-     *              System.out.printf("Close %d handles.", numOfClosedHandles)
-     *     )});
-     * 
- * @param handleId Specifies the handle ID to be closed. Use an asterisk ('*') as a wildcard string to specify all handles. - * @return The counts of number of handles closed - */ - public Iterable forceCloseHandles(String handleId) { - return fileAsyncClient.forceCloseHandles(handleId).toIterable(); - } -} - diff --git a/storage/client/src/main/java/com/azure/storage/file/FileClientBuilder.java b/storage/client/src/main/java/com/azure/storage/file/FileClientBuilder.java deleted file mode 100644 index 80969c2cfdc71..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/FileClientBuilder.java +++ /dev/null @@ -1,355 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLoggingPolicy; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; -import com.azure.core.util.configuration.Configuration; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.storage.common.credentials.SASTokenCredential; -import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.common.policy.SASTokenCredentialPolicy; -import com.azure.storage.common.policy.SharedKeyCredentialPolicy; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link FileClient FileClients} - * and {@link FileAsyncClient FileAsyncClients}, calling {@link FileClientBuilder#build() build} - * constructs an instance of FileClient and calling {@link FileClientBuilder#buildAsync() buildAsync} - * constructs an instance of FileAsyncClient. - * - *

The client needs the endpoint of the Azure Storage File service, name of the share, and authorization credential. - * {@link FileClientBuilder#endpoint(String) endpoint} gives the builder the endpoint and may give the builder the - * {@link FileClientBuilder#shareName(String)}, {@link FileClientBuilder#filePath(String)} and a {@link SASTokenCredential} that authorizes the client.

- * - *

Instantiating a synchronous File Client with SAS token

- * {@codesnippet com.azure.storage.file.fileClient.instantiation.sastoken} - * - *

Instantiating an Asynchronous File Client with SAS token

- * {@codesnippet com.azure.storage.file.directoryClient.instantiation.sastoken} - * - *

If the {@code endpoint} doesn't contain the query parameters to construct a {@code SASTokenCredential} they may - * be set using {@link FileClientBuilder#credential(SASTokenCredential) credential}.

- * - *
- * FileClient client = FileClient.builder()
- *     .endpoint(endpointWithoutSASTokenQueryParams)
- *     .shareName(shareName)
- *     .filePath(filePath)
- *     .credential(SASTokenCredential.fromQuery(SASTokenQueryParams))
- *     .build();
- * 
- * - *
- * FileAsyncClient client = FileAsyncClient.builder()
- *     .endpoint(endpointWithoutSASTokenQueryParams)
- *     .shareName(shareName)
- *     .filePath(filePath)
- *     .credential(SASTokenCredential.fromQuery(SASTokenQueryParams))
- *     .buildAsync();
- * 
- * - *

Another way to authenticate the client is using a {@link SharedKeyCredential}. To create a SharedKeyCredential - * a connection string from the Storage File service must be used. Set the SharedKeyCredential with - * {@link FileClientBuilder#connectionString(String) connectionString}. If the builder has both a SASTokenCredential and - * SharedKeyCredential the SharedKeyCredential will be preferred when authorizing requests sent to the service.

- * - *

Instantiating a synchronous File Client with connection string.

- * {@codesnippet com.azure.storage.file.directoryClient.instantiation.connectionstring} - * - *

Instantiating an Asynchronous File Client with connection string.

- * {@codesnippet com.azure.storage.file.directoryAsyncClient.instantiation.connectionstring} - * - * @see FileClient - * @see FileAsyncClient - * @see SASTokenCredential - * @see SharedKeyCredential - */ -public class FileClientBuilder { - private static final String ACCOUNT_NAME = "AccountName".toLowerCase(); - private final List policies; - private final RetryPolicy retryPolicy; - - private HttpLogDetailLevel logLevel; - private Configuration configuration; - private URL endpoint; - private String shareName; - private String filePath; - private SASTokenCredential sasTokenCredential; - private SharedKeyCredential sharedKeyCredential; - private HttpClient httpClient; - private HttpPipeline pipeline; - private String shareSnapshot; - - FileClientBuilder() { - retryPolicy = new RetryPolicy(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); - - configuration = ConfigurationManager.getConfiguration(); - } - - /** - * Creates a {@link FileAsyncClient} based on options set in the builder. Every time {@code buildAsync()} is - * called a new instance of {@link FileAsyncClient} is created. - * - *

- * If {@link FileClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and - * {@link FileClientBuilder#endpoint(String) endpoint} are used to create the - * {@link FileAsyncClient client}. All other builder settings are ignored. - *

- * - * @return A ShareAsyncClient with the options set from the builder. - * @throws NullPointerException If {@code endpoint} or {@code shareName} is {@code null}. - * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. - */ - public FileAsyncClient buildAsync() { - Objects.requireNonNull(endpoint); - - if (sasTokenCredential == null && sharedKeyCredential == null) { - throw new IllegalArgumentException("Credentials are required for authorization"); - } - - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - policies.add(new UserAgentPolicy(FileConfiguration.NAME, FileConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - - if (sharedKeyCredential != null) { - policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); - } else { - policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); - } - - HttpPolicyProviders.addBeforeRetryPolicies(policies); - - policies.add(retryPolicy); - - policies.addAll(this.policies); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(logLevel)); - - HttpPipeline pipeline = HttpPipeline.builder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); - - return new FileAsyncClient(endpoint, pipeline, shareName, filePath, shareSnapshot); - } - - /** - * Creates a {@link FileClient} based on options set in the builder. Every time {@code build()} is - * called a new instance of {@link FileClient} is created. - * - *

- * If {@link FileClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and - * {@link FileClientBuilder#endpoint(String) endpoint} are used to create the - * {@link FileClient client}. All other builder settings are ignored. - *

- * - * @return A FileClient with the options set from the builder. - * @throws NullPointerException If {@code endpoint}, {@code shareName} or {@code filePath} is {@code null}. - * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. - */ - public FileClient build() { - return new FileClient(this.buildAsync()); - } - - /** - * Sets the endpoint for the Azure Storage File instance that the client will interact with. - * - *

The first path segment, if the endpoint contains path segments, will be assumed to be the name of the share - * that the client will interact with. Rest of the path segments should be the path of the file. - * It mush end up with the file name if more segments exist.

- * - *

Query parameters of the endpoint will be parsed using {@link SASTokenCredential#(String) fromQuery} in an - * attempt to generate a {@link SASTokenCredential} to authenticate requests sent to the service.

- * - * @param endpoint The URL of the Azure Storage File instance to send service requests to and receive responses from. - * @return the updated FileClientBuilder object - * @throws IllegalArgumentException If {@code endpoint} is {@code null} or is an invalid URL - */ - public FileClientBuilder endpoint(String endpoint) { - Objects.requireNonNull(endpoint); - try { - URL fullURL = new URL(endpoint); - this.endpoint = new URL(fullURL.getProtocol() + "://" + fullURL.getHost()); - - // Attempt to get the share name and file path from the URL passed - String[] pathSegments = fullURL.getPath().split("/"); - int length = pathSegments.length; - this.shareName = length >= 2 ? pathSegments[1] : this.shareName; - String[] filePathParams = length >= 3 ? Arrays.copyOfRange(pathSegments, 2, length) : null; - this.filePath = filePathParams != null ? String.join("/", filePathParams) : this.filePath; - - // Attempt to get the SAS token from the URL passed - SASTokenCredential credential = SASTokenCredential.fromQuery(fullURL.getQuery()); - if (credential != null) { - this.sasTokenCredential = credential; - } - } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage File endpoint url is malformed."); - } - - return this; - } - - /** - * Sets the {@link SASTokenCredential} used to authenticate requests sent to the File service. - * - * @param credential SAS token credential generated from the Storage account that authorizes requests - * @return the updated FileClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public FileClientBuilder credential(SASTokenCredential credential) { - this.sasTokenCredential = credential; - return this; - } - - /** - * Creates a {@link SharedKeyCredential} from the {@code connectionString} used to authenticate requests sent to the - * File service. - * - * @param connectionString Connection string from the Access Keys section in the Storage account - * @return the updated FileClientBuilder object - * @throws NullPointerException If {@code connectionString} is {@code null}. - */ - public FileClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - this.sharedKeyCredential = SharedKeyCredential.fromConnectionString(connectionString); - getEndPointFromConnectionString(connectionString); - return this; - } - - private void getEndPointFromConnectionString(String connectionString) { - Map connectionStringPieces = new HashMap<>(); - for (String connectionStringPiece : connectionString.split(";")) { - String[] kvp = connectionStringPiece.split("=", 2); - connectionStringPieces.put(kvp[0].toLowerCase(), kvp[1]); - } - String accountName = connectionStringPieces.get(ACCOUNT_NAME); - try { - this.endpoint = new URL(String.format("https://%s.file.core.windows.net", accountName)); - } catch (MalformedURLException e) { - throw new IllegalArgumentException(String.format("There is no valid endpoint for the connection string. " + - "Connection String: %s", connectionString)); - } - } - - /** - * Sets the share that the constructed clients will interact with - * - * @param shareName Name of the share - * @return the updated FileClientBuilder object - * @throws NullPointerException If {@code shareName} is {@code null}. - */ - public FileClientBuilder shareName (String shareName) { - this.shareName = shareName; - return this; - } - - /** - * Sets the file that the constructed clients will interact with - * - * @param filePath Path of the file, mush end up with the file name. - * @return the updated FileClientBuilder object - * @throws NullPointerException If {@code filePath} is {@code null}. - */ - public FileClientBuilder filePath(String filePath) { - this.filePath = filePath; - return this; - } - - /** - * Sets the HTTP client to use for sending and receiving requests to and from the service. - * - * @param httpClient The HTTP client to use for requests. - * @return The updated FileClientBuilder object. - * @throws NullPointerException If {@code httpClient} is {@code null}. - */ - public FileClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - /** - * Adds a policy to the set of existing policies that are executed after the {@link RetryPolicy}. - * - * @param pipelinePolicy The retry policy for service requests. - * @return The updated FileClientBuilder object. - * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. - */ - public FileClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - this.policies.add(pipelinePolicy); - return this; - } - - /** - * Sets the logging level for HTTP requests and responses. - * - * @param logLevel The amount of logging output when sending and receiving HTTP requests/responses. - * @return The updated FileClientBuilder object. - */ - public FileClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { - this.logLevel = logLevel; - return this; - } - - /** - * Sets the HTTP pipeline to use for the service client. - * - *

If {@code pipeline} is set, all other settings are ignored, aside from {@link FileClientBuilder#endpoint(String) endpoint}, - * {@link FileClientBuilder#shareName(String) shareName} @{link FileClientBuilder#filePath(String) filePath}, and {@link FileClientBuilder#shareSnapshot(String) snaphotShot} - * when building clients.

- * - * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. - * @return The updated FileClientBuilder object. - * @throws NullPointerException If {@code pipeline} is {@code null}. - */ - public FileClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = Objects.requireNonNull(pipeline); - return this; - } - - /** - * Sets the configuration object used to retrieve environment configuration values used to build the client with - * when they are not set in the builder, defaults to Configuration.NONE - * @param configuration configuration store - * @return the updated FileClientBuilder object - */ - public FileClientBuilder configuration(Configuration configuration) { - this.configuration = configuration; - return this; - } - - /** - * Sets the snapshot that the constructed clients will interact with. This snapshot must be linked to the share - * that has been specified in the builder. - * - * @param shareSnapshot Identifier of the snapshot - * @return the updated FileClientBuilder object - * @throws NullPointerException If {@code shareSnapshot} is {@code null}. - */ - public FileClientBuilder shareSnapshot(String shareSnapshot) { - this.shareSnapshot = shareSnapshot; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java b/storage/client/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java deleted file mode 100644 index efb3756b44f34..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/FileServiceAsyncClient.java +++ /dev/null @@ -1,373 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.http.rest.VoidResponse; -import com.azure.core.implementation.util.ImplUtils; -import com.azure.core.util.Context; -import com.azure.storage.common.credentials.SASTokenCredential; -import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.file.implementation.AzureFileStorageBuilder; -import com.azure.storage.file.implementation.AzureFileStorageImpl; -import com.azure.storage.file.models.CorsRule; -import com.azure.storage.file.models.DeleteSnapshotsOptionType; -import com.azure.storage.file.models.FileServiceProperties; -import com.azure.storage.file.models.ListSharesIncludeType; -import com.azure.storage.file.models.ListSharesOptions; -import com.azure.storage.file.models.ListSharesResponse; -import com.azure.storage.file.models.ServicesListSharesSegmentResponse; -import com.azure.storage.file.models.ShareItem; -import com.azure.storage.file.models.StorageErrorException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import org.reactivestreams.Publisher; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * This class provides a client that contains all the operations for interacting with a file account in Azure Storage. - * Operations allowed by the client are creating, listing, and deleting shares and retrieving and updating properties - * of the account. - * - *

Instantiating an Asynchronous File Service Client

- * - *
- * FileServiceAsyncClient client = FileServiceAsyncClient.builder()
- *     .connectionString(connectionString)
- *     .endpoint(endpoint)
- *     .buildAsync();
- * 
- * - *

View {@link FileServiceClientBuilder this} for additional ways to construct the client.

- * - * @see FileServiceClientBuilder - * @see FileServiceClient - * @see SharedKeyCredential - * @see SASTokenCredential - */ -public final class FileServiceAsyncClient { - private final AzureFileStorageImpl client; - - /** - * Creates a FileServiceClient that sends requests to the storage account at {@code endpoint}. - * Each service call goes through the {@code httpPipeline}. - * - * @param endpoint URL for the Storage File service - * @param httpPipeline HttpPipeline that the HTTP requests and responses flow through - */ - FileServiceAsyncClient(URL endpoint, HttpPipeline httpPipeline) { - this.client = new AzureFileStorageBuilder().pipeline(httpPipeline) - .url(endpoint.toString()) - .build(); - } - - /** - * Creates a builder that can configure options for the FileServiceAsyncClient before creating an instance of it. - * - * @return A new {@link FileServiceClientBuilder} used to create FileServiceAsyncClient instances. - */ - public static FileServiceClientBuilder builder() { - return new FileServiceClientBuilder(); - } - - /** - * @return the getFileServiceUrl of the Storage File service - */ - public String getFileServiceUrl() { - return client.url(); - } - - /** - * Constructs a ShareAsyncClient that interacts with the specified share. - * - *

If the share doesn't exist in the storage account {@link ShareAsyncClient#create() create} in the client will - * need to be called before interaction with the share can happen.

- * - * @param shareName Name of the share - * @return a ShareAsyncClient that interacts with the specified share - */ - public ShareAsyncClient getShareAsyncClient(String shareName) { - return new ShareAsyncClient(client, shareName); - } - - /** - * Lists all shares in the storage account without their metadata or snapshots. - * - *

Code Samples

- * - *

List all shares in the account

- * - * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.listShares} - * - * @return {@link ShareItem Shares} in the storage account without their metadata or snapshots - */ - public Flux listShares() { - return listShares(null); - } - - /** - * Lists the shares in the Storage account that pass the options filter. - * - *

Set starts with name filter using {@link ListSharesOptions#prefix(String) prefix} to filter shares that are - * listed.

- * - *

Pass true to {@link ListSharesOptions#includeMetadata(boolean) includeMetadata} to have metadata returned for - * the shares.

- * - *

Pass true to {@link ListSharesOptions#includeSnapshots(boolean) includeSnapshots} to have snapshots of the - * shares listed.

- * - *

Code Samples

- * - *

List all shares that begin with "azure"

- * - *
-     * client.listShares(new ListSharesOptions().prefix("azure"))
-     *     .subscribe(result -> System.out.printf("Share %s exists in the account", result.name()));
-     * 
- * - *

List all shares including their snapshots and metadata

- * - *
-     * client.listShares(new ListSharesOptions().includeMetadata(true).includeSnapshots(true))
-     *     .subscribe(result -> System.out.printf("Share %s, Is Snapshot? %b, Metadata: %s", result.name(), result.snapshot() != null, result.metadata()));
-     * 
- * - * @param options Options for listing shares - * @return {@link ShareItem Shares} in the storage account that satisfy the filter requirements - */ - public Flux listShares(ListSharesOptions options) { - return listShares(null, options); - } - - /** - * Lists the shares in the storage account that pass the filter starting at the specified marker. - * - * @param marker Starting point to list the shares - * @param options Options for listing shares - * @return {@link ShareItem Shares} in the storage account that satisfy the filter requirements - */ - private Flux listShares(String marker, ListSharesOptions options) { - String prefix = null; - Integer maxResults = null; - List include = new ArrayList<>(); - - if (options != null) { - prefix = options.prefix(); - maxResults = options.maxResults(); - - if (options.includeMetadata()) { - include.add(ListSharesIncludeType.fromString(ListSharesIncludeType.METADATA.toString())); - } - - if (options.includeSnapshots()) { - include.add(ListSharesIncludeType.fromString(ListSharesIncludeType.SNAPSHOTS.toString())); - } - } - - return client.services().listSharesSegmentWithRestResponseAsync(prefix, marker, maxResults, include, null, Context.NONE) - .flatMapMany(response -> Flux.fromIterable(response.value().shareItems())); - } - - /* - * Helper function used to auto-enumerate through paged responses - */ - private Flux listShares(ServicesListSharesSegmentResponse response, List include, Context context) { - ListSharesResponse value = response.value(); - Mono result = client.services() - .listSharesSegmentWithRestResponseAsync(value.prefix(), value.marker(), value.maxResults(), include, null, context); - - return result.flatMapMany(r -> extractAndFetchShares(r, include, context)); - } - - /* - * Helper function used to auto-enumerate through paged responses - */ - private Publisher extractAndFetchShares(ServicesListSharesSegmentResponse response, List include, Context context) { - String nextPageLink = response.value().nextMarker(); - if (ImplUtils.isNullOrEmpty(nextPageLink)) { - return Flux.fromIterable(response.value().shareItems()); - } - - return Flux.fromIterable(response.value().shareItems()).concatWith(listShares(response, include, context)); - } - - /** - * Retrieves the properties of the storage account's File service. The properties range from storage analytics and - * metrics to CORS (Cross-Origin Resource Sharing). - * - *

Code Samples

- * - *

Retrieve File service properties

- * - *
-     * client.getProperties()
-     *    .subscribe(response -> {
-     *        FileServiceProperties properties = response.value();
-     *        System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", properties.hourMetrics().enabled(), properties.minuteMetrics().enabled());
-     *    });
-     * 
- * - * @return Storage account File service properties - */ - public Mono> getProperties() { - return client.services().getPropertiesWithRestResponseAsync(Context.NONE) - .map(response -> mapToResponse(response, response.value())); - } - - /** - * Sets the properties for the storage account's File service. The properties range from storage analytics and - * metric to CORS (Cross-Origin Resource Sharing). - * - * To maintain the CORS in the Queue service pass a {@code null} value for {@link FileServiceProperties#cors() CORS}. - * To disable all CORS in the Queue service pass an empty list for {@link FileServiceProperties#cors() CORS}. - * - *

Code Sample

- * - *

Clear CORS in the File service

- * - *
-     * FileServiceProperties properties = client.getProperties().block().value();
-     * properties.cors(Collections.emptyList());
-     *
-     * client.setProperties(properties)
-     *     .subscribe(response -> System.out.printf("Setting File service properties completed with status code %d", response.statusCode()));
-     * 
- * - *

Enable Minute and Hour Metrics

- * - *
-     * FileServiceProperties properties = client.getProperties().block().value();
-     * properties.minuteMetrics().enabled(true);
-     * properties.hourMetrics().enabled(true);
-     *
-     * client.setProperties(properties)
-     *     .subscribe(response -> System.out.printf("Setting File service properties completed with status code %d", response.statusCode()));
-     * 
- * - * @param properties Storage account File service properties - * @return A response that only contains headers and response status code - * @throws StorageErrorException When one of the following is true - *
    - *
  • A CORS rule is missing one of its fields
  • - *
  • More than five CORS rules will exist for the Queue service
  • - *
  • Size of all CORS rules exceeds 2KB
  • - *
  • - * Length of {@link CorsRule#allowedHeaders() allowed headers}, {@link CorsRule#exposedHeaders() exposed headers}, - * or {@link CorsRule#allowedOrigins() allowed origins} exceeds 256 characters. - *
  • - *
  • {@link CorsRule#allowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or PUT
  • - *
- */ - public Mono setProperties(FileServiceProperties properties) { - return client.services().setPropertiesWithRestResponseAsync(properties, Context.NONE) - .map(VoidResponse::new); - } - - /** - * Creates a share in the storage account with the specified name and returns a ShareAsyncClient to interact with it. - * - *

Code Samples

- * - *

Create the share "test"

- * - * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.createShare#string} - * - * @param shareName Name of the share - * @return A response containing the ShareAsyncClient and the status of creating the share. - * @throws StorageErrorException If a share with the same name already exists - */ - public Mono> createShare(String shareName) { - return createShare(shareName, null, null); - } - - /** - * Creates a share in the storage account with the specified name, metadata, and quota and returns a ShareAsyncClient to - * interact with it. - * - *

Code Samples

- * - *

Create the share "test" with metadata "share:metadata"

- * - *
-     * client.createShare("test", Collections.singletonMap("share", "metadata"), null)
-     *     .subscribe(response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()));
-     * 
- * - *

Create the share "test" with a quota of 10 GB

- * - *
-     * client.createShare("test", null, 10)
-     *     .subscribe(response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()));
-     * 
- * - * @param shareName Name of the share - * @param metadata Optional. Metadata to associate with the share - * @param quotaInGB Optional. Maximum size the share is allowed to grow to in GB. This must be greater than 0 and - * less than or equal to 5120. The default value is 5120. - * @return A response containing the ShareAsyncClient and the status of creating the share. - * @throws StorageErrorException If a share with the same name already exists or {@code quotaInGB} is outside the - * allowed range. - */ - public Mono> createShare(String shareName, Map metadata, Integer quotaInGB) { - ShareAsyncClient shareAsyncClient = new ShareAsyncClient(client, shareName); - - return shareAsyncClient.create(metadata, quotaInGB) - .map(response -> mapToResponse(response, shareAsyncClient)); - } - - /** - * Deletes the share in the storage account with the given name - * - *

Code Samples

- * - *

Delete the share "test"

- * - * {@codesnippet com.azure.storage.file.fileServiceClient.deleteShare#string} - * - * @param shareName Name of the share - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist - */ - public Mono deleteShare(String shareName) { - return deleteShare(shareName, null); - } - - /** - * Deletes the specific snapshot of the share in the storage account with the given name. Snapshot are identified - * by the time they were created. - * - *

Code Samples

- * - *

Delete the snapshot of share "test" that was created at midnight

- * - *
-     * OffsetDateTime midnight = OffsetDateTime.of(LocalTime.MIDNIGHT, ZoneOffset.UTC));
-     * client.deleteShare("test", midnight.toString())
-     *     .subscribe(response -> System.out.printf("Deleting the snapshot completed with status code %d", response.statusCode()));
-     * 
- * - * @param shareName Name of the share - * @param shareSnapshot Identifier of the snapshot - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist or the snapshot doesn't exist - */ - public Mono deleteShare(String shareName, String shareSnapshot) { - DeleteSnapshotsOptionType deleteSnapshots = null; - if (ImplUtils.isNullOrEmpty(shareSnapshot)) { - deleteSnapshots = DeleteSnapshotsOptionType.fromString(DeleteSnapshotsOptionType.INCLUDE.toString()); - } - return client.shares().deleteWithRestResponseAsync(shareName, shareSnapshot, null, deleteSnapshots, Context.NONE) - .map(VoidResponse::new); - } - - static Response mapToResponse(Response response, T value) { - return new SimpleResponse<>(response.request(), response.statusCode(), response.headers(), value); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/FileServiceClient.java b/storage/client/src/main/java/com/azure/storage/file/FileServiceClient.java deleted file mode 100644 index 1320cf9383bd3..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/FileServiceClient.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.VoidResponse; -import com.azure.storage.common.credentials.SASTokenCredential; -import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.file.models.CorsRule; -import com.azure.storage.file.models.FileServiceProperties; -import com.azure.storage.file.models.ListSharesOptions; -import com.azure.storage.file.models.ShareItem; -import com.azure.storage.file.models.StorageErrorException; -import java.util.Map; - -/** - * This class provides a client that contains all the operations for interacting with a file account in Azure Storage. - * Operations allowed by the client are creating, listing, and deleting shares and retrieving and updating properties - * of the account. - * - *

Instantiating a Synchronous File Service Client

- * - *
- * FileServiceClient client = FileServiceClient.builder()
- *     .connectionString(connectionString)
- *     .endpoint(endpoint)
- *     .build();
- * 
- * - *

View {@link FileServiceClientBuilder this} for additional ways to construct the client.

- * - * @see FileServiceClientBuilder - * @see FileServiceAsyncClient - * @see SharedKeyCredential - * @see SASTokenCredential - */ -public final class FileServiceClient { - private final FileServiceAsyncClient client; - - /** - * Creates a FileServiceClient that wraps a FileServiceAsyncClient and blocks requests. - * - * @param client FileServiceAsyncClient that is used to send requests - */ - FileServiceClient(FileServiceAsyncClient client) { - this.client = client; - } - - /** - * Creates a builder that can configure options for the FileServiceClient before creating an instance of it. - * - * @return A new {@link FileServiceClientBuilder} used to create FileServiceClient instances. - */ - public static FileServiceClientBuilder builder() { - return new FileServiceClientBuilder(); - } - - /** - * @return the getFileServiceUrl of the Storage File service - */ - public String getFileServiceUrl() { - return client.getFileServiceUrl(); - } - - /** - * Constructs a ShareClient that interacts with the specified share. - * - *

If the share doesn't exist in the storage account {@link ShareClient#create() create} in the client will - * need to be called before interaction with the share can happen.

- * - * @param shareName Name of the share - * @return a ShareClient that interacts with the specified share - */ - public ShareClient getShareClient(String shareName) { - return new ShareClient(client.getShareAsyncClient(shareName)); - } - - /** - * Lists all shares in the storage account without their metadata or snapshots. - * - *

Code Samples

- * - *

List all shares in the account

- * - * {@codesnippet com.azure.storage.file.fileServiceClient.listShares} - * - * @return {@link ShareItem Shares} in the storage account without their metadata or snapshots - */ - public Iterable listShares() { - return listShares(null); - } - - /** - * Lists the shares in the Storage account that pass the options filter. - * - *

Set starts with name filter using {@link ListSharesOptions#prefix(String) prefix} to filter shares that are - * listed.

- * - *

Pass true to {@link ListSharesOptions#includeMetadata(boolean) includeMetadata} to have metadata returned for - * the shares.

- * - *

Pass true to {@link ListSharesOptions#includeSnapshots(boolean) includeSnapshots} to have snapshots of the - * shares listed.

- * - *

Code Samples

- * - *

List all shares that begin with "azure"

- * - *
-     * for (ShareItem result : client.listShares(new ListSharesOptions().prefix("azure"))) {
-     *     System.out.printf("Share %s exists in the account", result.name());
-     * }
-     * 
- * - *

List all shares including their snapshots and metadata

- * - *
-     * for (ShareItem result : client.listShares(new ListSharesOptions().includeMetadata(true).includeSnapshots(true))) {
-     *     System.out.printf("Share %s, Is Snapshot? %b, Metadata: %s", result.name(), result.snapshot() != null, result.metadata());
-     * }
-     * 
- * - * @param options Options for listing shares - * @return {@link ShareItem Shares} in the storage account that satisfy the filter requirements - */ - public Iterable listShares(ListSharesOptions options) { - return client.listShares(options).toIterable(); - } - - /** - * Retrieves the properties of the storage account's File service. The properties range from storage analytics and - * metrics to CORS (Cross-Origin Resource Sharing). - * - *

Code Samples

- * - *

Retrieve File service properties

- * - *
-     * FileServiceProperties properties = client.getProperties().value();
-     * System.out.printf("Hour metrics enabled: %b, Minute metrics enabled: %b", properties.hourMetrics().enabled(), properties.minuteMetrics().enabled());
-     * 
- * - * @return Storage account File service properties - */ - public Response getProperties() { - return client.getProperties().block(); - } - - /** - * Sets the properties for the storage account's File service. The properties range from storage analytics and - * metric to CORS (Cross-Origin Resource Sharing). - * - * To maintain the CORS in the Queue service pass a {@code null} value for {@link FileServiceProperties#cors() CORS}. - * To disable all CORS in the Queue service pass an empty list for {@link FileServiceProperties#cors() CORS}. - * - *

Code Sample

- * - *

Clear CORS in the File service

- * - *
-     * FileServiceProperties properties = client.getProperties().value();
-     * properties.cors(Collections.emptyList());
-     *
-     * VoidResponse response = client.setProperties(properties);
-     * System.out.printf("Setting File service properties completed with status code %d", response.statusCode());
-     * 
- * - *

Enable Minute and Hour Metrics

- * - *
-     * FileServiceProperties properties = client.getProperties().value();
-     * properties.minuteMetrics().enabled(true);
-     * properties.hourMetrics().enabled(true);
-     *
-     * VoidResponse respone = client.setProperties(properties);
-     * System.out.printf("Setting File service properties completed with status code %d", response.statusCode());
-     * 
- * - * @param properties Storage account File service properties - * @return A response that only contains headers and response status code - * @throws StorageErrorException When one of the following is true - *
    - *
  • A CORS rule is missing one of its fields
  • - *
  • More than five CORS rules will exist for the Queue service
  • - *
  • Size of all CORS rules exceeds 2KB
  • - *
  • - * Length of {@link CorsRule#allowedHeaders() allowed headers}, {@link CorsRule#exposedHeaders() exposed headers}, - * or {@link CorsRule#allowedOrigins() allowed origins} exceeds 256 characters. - *
  • - *
  • {@link CorsRule#allowedMethods() Allowed methods} isn't DELETE, GET, HEAD, MERGE, POST, OPTIONS, or PUT
  • - *
- */ - public VoidResponse setProperties(FileServiceProperties properties) { - properties = new FileServiceProperties(); - return client.setProperties(properties).block(); - } - - /** - * Creates a share in the storage account with the specified name and returns a ShareClient to interact with it. - * - *

Code Samples

- * - *

Create the share with share name of "myshare"

- * {@codesnippet com.azure.storage.file.fileServiceClient.createShare#string} - * - * @param shareName Name of the share - * @return A response containing the ShareClient and the status of creating the share. - * @throws StorageErrorException If a share with the same name already exists - */ - public Response createShare(String shareName) { - return createShare(shareName, null, null); - } - - /** - * Creates a share in the storage account with the specified name and metadata and returns a ShareClient to - * interact with it. - * - *

Code Samples

- * - *

Create the share "test" with metadata "share:metadata"

- * - *
-     * Response<ShareClient> response = client.createShare("test", Collections.singletonMap("share", "metadata"), null);
-     * System.out.printf("Creating the share completed with status code %d", response.statusCode());
-     * 
- * - *

Create the share "test" with a quota of 10 GB

- * - *
-     * Response<ShareClient> response = client.createShare("test", null, 10)
-     * System.out.printf("Creating the share completed with status code %d", response.statusCode());
-     * 
- * - * @param shareName Name of the share - * @param metadata Optional. Metadata to associate with the share - * @param quotaInGB Optional. Maximum size the share is allowed to grow to in GB. This must be greater than 0 and - * less than or equal to 5120. The default value is 5120. - * @return A response containing the ShareClient and the status of creating the share. - * @throws StorageErrorException If a share with the same name already exists or {@code quotaInGB} is outside the - * allowed range. - */ - public Response createShare(String shareName, Map metadata, Integer quotaInGB) { - Response response = client.createShare(shareName, metadata, quotaInGB).block(); - return FileServiceAsyncClient.mapToResponse(response, new ShareClient(response.value())); - } - - /** - * Deletes the share in the storage account with the given name - * - *

Code Samples

- * - *

Delete the share "test"

- * - * {@codesnippet com.azure.storage.file.fileServiceClient.deleteShare#string} - * - * @param shareName Name of the share - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist - */ - public VoidResponse deleteShare(String shareName) { - return deleteShare(shareName, null); - } - - /** - * Deletes the specific snapshot of the share in the storage account with the given name. Snapshot are identified - * by the time they were created. - * - *

Code Samples

- * - *

Delete the snapshot of share "test" that was created at midnight

- * - *
-     * OffsetDateTime midnight = OffsetDateTime.of(LocalTime.MIDNIGHT, ZoneOffset.UTC));
-     * VoidResponse response = client.deleteShare("test", midnight.toString());
-     * System.out.printf("Deleting the snapshot completed with status code %d", response.statusCode());
-     * 
- * - * @param shareName Name of the share - * @param shareSnapshot Identifier of the snapshot - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist or the snapshot doesn't exist - */ - public VoidResponse deleteShare(String shareName, String shareSnapshot) { - return client.deleteShare(shareName, shareSnapshot).block(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/FileServiceClientBuilder.java b/storage/client/src/main/java/com/azure/storage/file/FileServiceClientBuilder.java deleted file mode 100644 index 7bbd5b3b177c4..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/FileServiceClientBuilder.java +++ /dev/null @@ -1,302 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLoggingPolicy; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; -import com.azure.core.util.configuration.Configuration; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.storage.common.credentials.SASTokenCredential; -import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.common.policy.SASTokenCredentialPolicy; -import com.azure.storage.common.policy.SharedKeyCredentialPolicy; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link FileServiceClient FileServiceClients} - * and {@link FileServiceAsyncClient FileServiceAsyncClients}, calling {@link FileServiceClientBuilder#build() build} - * constructs an instance of FileServiceClient and calling {@link FileServiceClientBuilder#buildAsync() buildAsync} - * constructs an instance of FileServiceAsyncClient. - * - *

The client needs the endpoint of the Azure Storage File service and authorization credential. - * {@link FileServiceClientBuilder#endpoint(String) endpoint} gives the builder the endpoint and may give the builder a - * {@link SASTokenCredential} that authorizes the client.

- * - *

Instantiating a synchronous FileService Client with SAS token

- * {@codesnippet com.azure.storage.file.fileServiceClient.instantiation.sastoken} - * - *

Instantiating an Asynchronous FileService Client with SAS token

- * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.instantiation.sastoken} - * - *

If the {@code endpoint} doesn't contain the query parameters to construct a {@code SASTokenCredential} they may - * be set using {@link FileServiceClientBuilder#credential(SASTokenCredential) credential}.

- * - *
- * FileServiceClient client = FileServiceClient.builder()
- *     .endpoint(endpointWithoutSASTokenQueryParams)
- *     .credential(SASTokenCredential.fromQuery(SASTokenQueryParams))
- *     .build();
- * 
- * - *
- * FileServiceAsyncClient client = FileServiceAsyncClient.builder()
- *     .endpoint(endpointWithoutSASTokenQueryParams)
- *     .credential(SASTokenCredential.fromQuery(SASTokenQueryParams))
- *     .buildAsync();
- * 
- * - *

Another way to authenticate the client is using a {@link SharedKeyCredential}. To create a SharedKeyCredential - * a connection string from the Storage File service must be used. Set the SharedKeyCredential with - * {@link FileServiceClientBuilder#connectionString(String) connectionString}. If the builder has both a SASTokenCredential and - * SharedKeyCredential the SharedKeyCredential will be preferred when authorizing requests sent to the service.

- * - *

Instantiating a synchronous FileService Client with connection string.

- * {@codesnippet com.azure.storage.file.fileServiceClient.instantiation.connectionstring} - * - *

Instantiating an Asynchronous FileService Client with connection string.

- * {@codesnippet com.azure.storage.file.fileServiceAsyncClient.instantiation.connectionstring} - * - * @see FileServiceClient - * @see FileServiceAsyncClient - * @see SASTokenCredential - * @see SharedKeyCredential - */ -public final class FileServiceClientBuilder { - private static final String ACCOUNT_NAME = "AccountName".toLowerCase(); - private final List policies; - - private URL endpoint; - private SASTokenCredential sasTokenCredential; - private SharedKeyCredential sharedKeyCredential; - private HttpClient httpClient; - private HttpPipeline pipeline; - private HttpLogDetailLevel logLevel; - private RetryPolicy retryPolicy; - private Configuration configuration; - - FileServiceClientBuilder() { - retryPolicy = new RetryPolicy(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); - configuration = ConfigurationManager.getConfiguration(); - } - - /** - * Creates a {@link FileServiceAsyncClient} based on options set in the builder. Every time {@code buildAsync()} is - * called a new instance of {@link FileServiceAsyncClient} is created. - * - *

- * If {@link FileServiceClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and - * {@link FileServiceClientBuilder#endpoint(String) endpoint} are used to create the - * {@link FileServiceAsyncClient client}. All other builder settings are ignored. - *

- * - * @return A FileServiceAsyncClient with the options set from the builder. - * @throws NullPointerException If {@code endpoint} is {@code null}. - * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. - */ - public FileServiceAsyncClient buildAsync() { - Objects.requireNonNull(endpoint); - - if (sasTokenCredential == null && sharedKeyCredential == null) { - throw new IllegalArgumentException("Credentials are required for authorization"); - } - - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - policies.add(new UserAgentPolicy(FileConfiguration.NAME, FileConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - - if (sharedKeyCredential != null) { - policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); - } else { - policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); - } - - HttpPolicyProviders.addBeforeRetryPolicies(policies); - - policies.add(retryPolicy); - - policies.addAll(this.policies); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(logLevel)); - - HttpPipeline pipeline = HttpPipeline.builder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); - - return new FileServiceAsyncClient(endpoint, pipeline); - } - - /** - * Creates a {@link FileServiceClient} based on options set in the builder. Every time {@code build()} is - * called a new instance of {@link FileServiceClient} is created. - * - *

- * If {@link FileServiceClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and - * {@link FileServiceClientBuilder#endpoint(String) endpoint} are used to create the - * {@link FileServiceClient client}. All other builder settings are ignored. - *

- * - * @return A FileServiceClient with the options set from the builder. - * @throws NullPointerException If {@code endpoint} is {@code null}. - * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. - */ - public FileServiceClient build() { - return new FileServiceClient(buildAsync()); - } - - /** - * Sets the endpoint for the Azure Storage File instance that the client will interact with. - * - *

Query parameters of the endpoint will be parsed using {@link SASTokenCredential#fromQuery(String) fromQuery} in an - * attempt to generate a {@link SASTokenCredential} to authenticate requests sent to the service.

- * - * @param endpoint The URL of the Azure Storage File instance to send service requests to and receive responses from. - * @return the updated FileServiceClientBuilder object - * @throws IllegalArgumentException If {@code endpoint} isn't a proper URL - */ - public FileServiceClientBuilder endpoint(String endpoint) { - Objects.requireNonNull(endpoint); - try { - URL fullURL = new URL(endpoint); - this.endpoint = new URL(fullURL.getProtocol() + "://" + fullURL.getHost()); - - // Attempt to get the SAS token from the URL passed - SASTokenCredential credential = SASTokenCredential.fromQuery(fullURL.getQuery()); - if (credential != null) { - this.sasTokenCredential = credential; - } - } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage File Service endpoint url is malformed."); - } - - return this; - } - - /** - * Sets the {@link SASTokenCredential} used to authenticate requests sent to the Queue service. - * - * @param credential SAS token credential generated from the Storage account that authorizes requests - * @return the updated FileServiceClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public FileServiceClientBuilder credential(SASTokenCredential credential) { - this.sasTokenCredential = Objects.requireNonNull(credential); - return this; - } - - /** - * Creates a {@link SharedKeyCredential} from the {@code connectionString} used to authenticate requests sent to the - * File service. - * - * @param connectionString Connection string from the Access Keys section in the Storage account - * @return the updated FileServiceClientBuilder object - * @throws NullPointerException If {@code connectionString} is {@code null}. - */ - public FileServiceClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - this.sharedKeyCredential = SharedKeyCredential.fromConnectionString(connectionString); - getEndPointFromConnectionString(connectionString); - return this; - } - - private void getEndPointFromConnectionString(String connectionString) { - Map connectionStringPieces = new HashMap<>(); - for (String connectionStringPiece : connectionString.split(";")) { - String[] kvp = connectionStringPiece.split("=", 2); - connectionStringPieces.put(kvp[0].toLowerCase(), kvp[1]); - } - String accountName = connectionStringPieces.get(ACCOUNT_NAME); - try { - this.endpoint = new URL(String.format("https://%s.file.core.windows.net", accountName)); - } catch (MalformedURLException e) { - throw new IllegalArgumentException(String.format("There is no valid endpoint for the connection string. " + - "Connection String: %s", connectionString)); - } - } - - /** - * Sets the HTTP client to use for sending and receiving requests to and from the service. - * - * @param httpClient The HTTP client to use for requests. - * @return The updated FileServiceClientBuilder object. - * @throws NullPointerException If {@code httpClient} is {@code null}. - */ - public FileServiceClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient); - return this; - } - - /** - * Adds a policy to the set of existing policies that are executed after the {@link RetryPolicy}. - * - * @param pipelinePolicy The retry policy for service requests. - * @return The updated FileServiceClientBuilder object. - * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. - */ - public FileServiceClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - Objects.requireNonNull(pipelinePolicy); - this.policies.add(pipelinePolicy); - return this; - } - - /** - * Sets the logging level for HTTP requests and responses. - * - * @param logLevel The amount of logging output when sending and receiving HTTP requests/responses. - * @return The updated FileServiceClientBuilder object. - */ - public FileServiceClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { - this.logLevel = logLevel; - return this; - } - - /** - * Sets the HTTP pipeline to use for the service client. - * - * If {@code pipeline} is set, all other settings are ignored, aside from {@link FileServiceClientBuilder#endpoint(String) endpoint} - * when building clients. - * - * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. - * @return The updated FileServiceClientBuilder object. - * @throws NullPointerException If {@code pipeline} is {@code null}. - */ - public FileServiceClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = Objects.requireNonNull(pipeline); - return this; - } - - /** - * Sets the configuration store that is used during construction of the service client. - * - * The default configuration store is a clone of the {@link ConfigurationManager#getConfiguration() global - * configuration store}, use {@link Configuration#NONE} to bypass using configuration settings during construction. - * - * @param configuration The configuration store used to - * @return The updated FileServiceClientBuilder object. - * @throws NullPointerException If {@code configuration} is {@code null}. - */ - public FileServiceClientBuilder configuration(Configuration configuration) { - this.configuration = Objects.requireNonNull(configuration); - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/ShareAsyncClient.java b/storage/client/src/main/java/com/azure/storage/file/ShareAsyncClient.java deleted file mode 100644 index 813a79e8b14a4..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/ShareAsyncClient.java +++ /dev/null @@ -1,520 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.http.rest.VoidResponse; -import com.azure.core.implementation.DateTimeRfc1123; -import com.azure.core.util.Context; -import com.azure.storage.common.credentials.SASTokenCredential; -import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.file.implementation.AzureFileStorageBuilder; -import com.azure.storage.file.implementation.AzureFileStorageImpl; -import com.azure.storage.file.models.ShareCreateSnapshotHeaders; -import com.azure.storage.file.models.ShareGetPropertiesHeaders; -import com.azure.storage.file.models.ShareInfo; -import com.azure.storage.file.models.ShareProperties; -import com.azure.storage.file.models.ShareSnapshotInfo; -import com.azure.storage.file.models.ShareStatistics; -import com.azure.storage.file.models.SharesCreateSnapshotResponse; -import com.azure.storage.file.models.SharesGetPropertiesResponse; -import com.azure.storage.file.models.SharesGetStatisticsResponse; -import com.azure.storage.file.models.SignedIdentifier; -import com.azure.storage.file.models.StorageErrorException; -import java.net.URL; -import java.time.OffsetDateTime; -import java.util.List; -import java.util.Map; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** - * This class provides a client that contains all the operations for interacting with a share in Azure Storage Share. - * Operations allowed by the client are creating and deleting the share, creating snapshots for the share, creating and - * deleting directories in the share and retrieving and updating properties metadata and access policies of the share. - * - *

Instantiating an Asynchronous Share Client

- * - *
- * ShareAsyncClient client = ShareAsyncClient.builder()
- *     .connectionString(connectionString)
- *     .endpoint(endpoint)
- *     .buildAsync();
- * 
- * - *

View {@link ShareClientBuilder this} for additional ways to construct the client.

- * - * @see ShareClientBuilder - * @see ShareClient - * @see SharedKeyCredential - * @see SASTokenCredential - */ -public class ShareAsyncClient { - private final AzureFileStorageImpl client; - private final String shareName; - private final String shareSnapshot; - - /** - * Creates a ShareAsyncClient that sends requests to the storage share at {@link AzureFileStorageImpl#url() endpoint}. - * Each service call goes through the {@link HttpPipeline pipeline} in the {@code client}. - * - * @param client Client that interacts with the service interfaces - * @param shareName Name of the share - */ - ShareAsyncClient(AzureFileStorageImpl client, String shareName) { - this.shareName = shareName; - this.shareSnapshot = null; - - this.client = new AzureFileStorageBuilder().pipeline(client.httpPipeline()) - .url(client.url()) - .version(client.version()) - .build(); - } - - /** - * Creates a ShareAsyncClient that sends requests to the storage share at {@code endpoint}. - * Each service call goes through the {@code httpPipeline}. - * - * @param endpoint URL for the Storage File service - * @param httpPipeline HttpPipeline that the HTTP requests and response flow through - * @param shareName Name of the share - * @param shareSnapshot Optional. Specific snapshot of the share - */ - ShareAsyncClient(URL endpoint, HttpPipeline httpPipeline, String shareName, String shareSnapshot) { - this.shareName = shareName; - this.shareSnapshot = shareSnapshot; - - this.client = new AzureFileStorageBuilder().pipeline(httpPipeline) - .url(endpoint.toString()) - .build(); - } - - /** - * Creates a builder that can configure options for the ShareAsyncClient before creating an instance of it. - * - * @return A new {@link ShareClientBuilder} used create ShareAsyncClient instances. - */ - public static ShareClientBuilder builder() { - return new ShareClientBuilder(); - } - - /** - * @return the getShareUrl of the storage file service - */ - public String getShareUrl() { - return client.url(); - } - - - /** - * Constructs a {@link DirectoryAsyncClient} that interacts with the root directory in the share. - * - *

If the directory doesn't exist in the share {@link DirectoryAsyncClient#create(Map) create} in the client will - * need to be called before interaction with the directory can happen.

- * - * @return a {@link DirectoryAsyncClient} that interacts with the root directory in the share - */ - public DirectoryAsyncClient getRootDirectoryClient() { - return getDirectoryClient(""); - } - - /** - * Constructs a {@link DirectoryAsyncClient} that interacts with the specified directory. - * - *

If the directory doesn't exist in the share {@link DirectoryAsyncClient#create(Map) create} in the client will - * need to be called before interaction with the directory can happen.

- * - * @param directoryName Name of the directory - * @return a {@link DirectoryAsyncClient} that interacts with the directory in the share - */ - public DirectoryAsyncClient getDirectoryClient(String directoryName) { - return new DirectoryAsyncClient(client, shareName, directoryName, shareSnapshot); - } - - /** - * Creates the share in the storage account. - * - *

Code Samples

- * - *

Create the share

- * - * {@codesnippet com.azure.storage.file.shareAsyncClient.create} - * - * @return A response containing information about the share and the status its creation. - * @throws StorageErrorException If the share already exists with different metadata - */ - public Mono> create() { - return create(null, null); - } - - /** - * Creates the share in the storage account with the specified metadata and quota. - * - *

Code Samples

- * - *

Create the share with metadata "share:metadata"

- * - *
-     * client.createShare(Collections.singletonMap("share", "metadata"), null)
-     *     .subscribe(response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()));
-     * 
- * - *

Create the share with a quota of 10 GB

- * - *
-     * client.createShare(null, 10)
-     *     .subscribe(response -> System.out.printf("Creating the share completed with status code %d", response.statusCode()));
-     * 
- * - * @param metadata Optional. Metadata to associate with the share - * @param quotaInGB Optional. Maximum size the share is allowed to grow to in GB. This must be greater than 0 and - * less than or equal to 5120. The default value is 5120. - * @return A response containing information about the share and the status its creation. - * @throws StorageErrorException If the share already exists with different metadata or {@code quotaInGB} is outside the - * allowed range. - */ - public Mono> create(Map metadata, Integer quotaInGB) { - return client.shares().createWithRestResponseAsync(shareName, null, metadata, quotaInGB, Context.NONE) - .map(this::mapToShareInfoResponse); - } - - /** - * Creates a snapshot of the share with the same metadata associated to the share at the time of creation. - * - *

Code Samples

- * - *

Create a snapshot

- * - * {@codesnippet com.azure.storage.file.shareAsyncClient.createSnapshot} - * - * @return A response containing information about the snapshot of share. - * @throws StorageErrorException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is - * in progress for the share - */ - public Mono> createSnapshot() { - return createSnapshot(null); - } - - /** - * Creates a snapshot of the share with the metadata that was passed associated to the snapshot. - * - *

Code Samples

- * - *

Create a snapshot with metadata "snapshot:metadata"

- * - * {@codesnippt com.azure.storage.file.shareClientAsync.createSnapshot} - * - * @param metadata Optional. Metadata to associate with the snapshot. If {@code null} the metadata of the share - * will be copied to the snapshot. - * @return A response containing information about the snapshot of share. - * @throws StorageErrorException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is - * in progress for the share - */ - public Mono> createSnapshot(Map metadata) { - return client.shares().createSnapshotWithRestResponseAsync(shareName, null, metadata, Context.NONE) - .map(this::mapCreateSnapshotResponse); - } - - /** - * Deletes the share in the storage account - * - *

Code Samples

- * - *

Delete the share

- * - * {@codesnippet com.azure.storage.file.shareAsyncClient.delete} - * - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist - */ - public Mono delete() { - return delete(null); - } - - /** - * Deletes the specific snapshot of the share in the storage account. Snapshot are identified by the time they - * were created. - * - *

Code Samples

- * - *

Delete the snapshot of share that was created at midnight

- * - *
-     * OffsetDateTime midnight = OffsetDateTime.of(LocalTime.MIDNIGHT, ZoneOffset.UTC));
-     * client.deleteShare(midnight.toString())
-     *     .subscribe(response -> System.out.printf("Deleting the snapshot completed with status code %d", response.statusCode()));
-     * 
- * - * @param shareSnapshot Identifier of the snapshot - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist or the snapshot doesn't exist - */ - public Mono delete(String shareSnapshot) { - return client.shares().deleteWithRestResponseAsync(shareName, shareSnapshot, null, null, Context.NONE) - .map(VoidResponse::new); - } - - /** - * Retrieves the properties of the share, these include the metadata associated to it and the quota that the share - * is restricted to. - * - *

Code Samples

- * - *

Retrieve the share properties

- * - *
-     * client.getProperties()
-     *     .subscribe(response -> {
-     *         ShareProperties properties = response.value();
-     *         System.out.printf("Share quota: %d, Metadata: %s", properties.quota(), properties.metadata());
-     *     });
-     * 
- * - * @return the properties of the share - * @throws StorageErrorException If the share doesn't exist - */ - public Mono> getProperties() { - return getProperties(null); - } - - /** - * Retrieves the properties of a specific snapshot of the share, these include the metadata associated to it and - * the quota that the share is restricted to. - * - *

Code Samples

- * - *

Retrieve the properties from the snapshot at midnight

- * - *
-     * OffsetDateTime midnight = OffsetDateTime.of(LocalTime.MIDNIGHT, ZoneOffset.UTC));
-     * client.getProperties(midnight.toString())
-     *     .subscribe(response -> {
-     *         ShareProperties properties = response.value();
-     *         System.out.printf("Share quota: %d, Metadata: %s", properties.quota(), properties.metadata());
-     *     });
-     * 
- * - * @param shareSnapshot Identifier of the snapshot - * @return the properties of the share snapshot - * @throws StorageErrorException If the share or snapshot doesn't exist - */ - public Mono> getProperties(String shareSnapshot) { - return client.shares().getPropertiesWithRestResponseAsync(shareName, shareSnapshot, null, Context.NONE) - .map(this::mapGetPropertiesResponse); - } - - /** - * Sets the maximum size in GB that the share is allowed to grow. - * - *

Code Samples

- * - *

Set the quota to 1024 GB

- * - *
-     * client.setQuota(1024)
-     *     .subscribe(response -> System.out.printf("Setting the share quota completed with status code %d", response.statusCode()));
-     * 
- * - * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. - * @return information about the share - * @throws StorageErrorException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds - */ - public Mono> setQuota(int quotaInGB) { - return client.shares().setQuotaWithRestResponseAsync(shareName, null, quotaInGB, Context.NONE) - .map(this::mapToShareInfoResponse); - } - - /** - * Sets the user-defined metadata to associate to the share. - * - *

If {@code null} is passed for the metadata it will clear the metadata associated to the share.

- * - *

Code Samples

- * - *

Set the metadata to "share:updatedMetadata"

- * - *
-     * client.setMetadata(Collections.singletonMap("share", "updatedMetadata"))
-     *     .subscribe(response -> System.out.printf("Setting the share metadata completed with status code %d", response.statusCode()));
-     * 
- * - *

Clear the metadata of the share

- * - *
-     * client.setMetadata(null)
-     *     .subscribe(response -> System.out.printf("Clearing the share metadata completed with status code %d", response.statusCode()));
-     * 
- * - * @param metadata Metadata to set on the share, if null is passed the metadata for the share is cleared - * @return information about the share - * @throws StorageErrorException If the share doesn't exist or the metadata contains invalid keys - */ - public Mono> setMetadata(Map metadata) { - return client.shares().setMetadataWithRestResponseAsync(shareName, null, metadata, Context.NONE) - .map(this::mapToShareInfoResponse); - } - - /** - * Retrieves stored access policies specified for the share. - * - *

Code Samples

- * - *

List the stored access policies

- * - *
-     * client.getAccessPolicy()
-     *     .subscribe(result -> System.out.printf("Access policy %s allows these permissions: %s", result.id(), result.accessPolicy().permission()));
-     * 
- * - * @return The stored access policies specified on the queue. - * @throws StorageErrorException If the share doesn't exist - */ - public Flux getAccessPolicy() { - return client.shares().getAccessPolicyWithRestResponseAsync(shareName, Context.NONE) - .flatMapMany(response -> Flux.fromIterable(response.value())); - } - - /** - * Sets stored access policies for the share. - * - *

Code Samples

- * - *

Set a read only stored access policy

- * - *
-     * AccessPolicy policy = new AccessPolicy().permission("r")
-     *     .start(OffsetDateTime.now(ZoneOffset.UTC))
-     *     .expiry(OffsetDateTime.now(ZoneOffset.UTC).addDays(10));
-     *
-     * SignedIdentifier permission = new SignedIdentifier().id("mypolicy").accessPolicy(accessPolicy);
-     *
-     * client.setAccessPolicy(Collections.singletonList(permission))
-     *     .subscribe(response -> System.out.printf("Setting access policies completed with status code %d", response.statusCode()));
-     * 
- * - * @param permissions Access policies to set on the queue - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist, a stored access policy doesn't have all fields filled out, - * or the share will have more than five policies. - */ - public Mono> setAccessPolicy(List permissions) { - return client.shares().setAccessPolicyWithRestResponseAsync(shareName, permissions, null, Context.NONE) - .map(this::mapToShareInfoResponse); - } - - /** - * Retrieves storage statistics about the share. - * - *

Code Samples

- * - *

Retrieve the storage statistics

- * - *
-     * client.getStatistics()
-     *     .subscribe(response -> System.out.printf("The share is using %d GB", response.value().getShareUsageInGB()));
-     * 
- * - * @return the storage statistics of the share - */ - public Mono> getStatistics() { - return client.shares().getStatisticsWithRestResponseAsync(shareName, Context.NONE) - .map(this::mapGetStatisticsResponse); - } - - /** - * Creates the directory in the share with the given name. - * - *

Code Samples

- * - *

Create the directory "mydirectory"

- * - * {@codesnippet com.azure.storage.file.shareAsyncClient.createDirectory#string} - * * - * @param directoryName Name of the directory - * @return A response containing a {@link DirectoryAsyncClient} to interact with the created directory and the - * status of its creation. - * @throws StorageErrorException If the share doesn't exist, the directory already exists or is in the process of - * being deleted, or the parent directory for the new directory doesn't exist - */ - public Mono> createDirectory(String directoryName) { - return createDirectory(directoryName, null); - } - - /** - * Creates the directory in the share with the given name and associates the passed metadata to it. - * - *

Code Samples

- * - *

Create the directory "documents" with metadata "directory:metadata"

- * - *
-     * client.createDirectory("documents", Collections.singletonMap("directory", "metadata"))
-     *     .subscribe(response -> System.out.printf("Creating the directory completed with status code %d", response.statusCode()));
-     * 
- * - * @param directoryName Name of the directory - * @param metadata Optional. Metadata to associate with the directory - * @return A response containing a {@link DirectoryAsyncClient} to interact with the created directory and the - * status of its creation. - * @throws StorageErrorException If the share doesn't exist, the directory already exists or is in the process of - * being deleted, the parent directory for the new directory doesn't exist, or the metadata is using an illegal - * key name - */ - public Mono> createDirectory(String directoryName, Map metadata) { - return getDirectoryClient(directoryName).create(metadata).map(response -> mapResponse(response, new DirectoryAsyncClient(client, shareName, directoryName, shareSnapshot))); - } - - /** - * Deletes the specified directory in the share. - * - *

Code Samples

- * - *

Delete the directory "empty"

- * - * {@codesnippet com.azure.storage.file.shareAsyncClient.deleteDirectory#string} - * - * @param directoryName Name of the directory - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist or the directory isn't empty - */ - public Mono deleteDirectory(String directoryName) { - return getDirectoryClient(directoryName).delete().map(VoidResponse::new); - } - - private SimpleResponse mapResponse(Response response, T value) { - return new SimpleResponse<>(response.request(), response.statusCode(), response.headers(), value); - } - - private Response mapToShareInfoResponse(Response response) { - String eTag = response.headers().value("ETag"); - OffsetDateTime lastModified = new DateTimeRfc1123(response.headers().value("Last-Modified")).dateTime(); - - return new SimpleResponse<>(response.request(), response.statusCode(), response.headers(), new ShareInfo(eTag, lastModified)); - } - - private Response mapCreateSnapshotResponse(SharesCreateSnapshotResponse response) { - ShareCreateSnapshotHeaders headers = response.deserializedHeaders(); - ShareSnapshotInfo snapshotInfo = new ShareSnapshotInfo(headers.snapshot(), headers.eTag(), headers.lastModified()); - - return new SimpleResponse<>(response.request(), response.statusCode(), response.headers(), snapshotInfo); - } - - private Response mapGetPropertiesResponse(SharesGetPropertiesResponse response) { - ShareGetPropertiesHeaders headers = response.deserializedHeaders(); - ShareProperties shareProperties = new ShareProperties().quota(headers.quota()) - .etag(headers.eTag()) - .lastModified(headers.lastModified()) - .metadata(headers.metadata()); - - return new SimpleResponse<>(response.request(), response.statusCode(), response.headers(), shareProperties); - } - - private Response mapGetStatisticsResponse(SharesGetStatisticsResponse response) { - ShareStatistics shareStatistics = new ShareStatistics(response.value().shareUsageBytes() / 1024); - - return new SimpleResponse<>(response.request(), response.statusCode(), response.headers(), shareStatistics); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/ShareClient.java b/storage/client/src/main/java/com/azure/storage/file/ShareClient.java deleted file mode 100644 index 4e38e4cdb0ea3..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/ShareClient.java +++ /dev/null @@ -1,429 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.VoidResponse; -import com.azure.storage.common.credentials.SASTokenCredential; -import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.file.models.ShareInfo; -import com.azure.storage.file.models.ShareProperties; -import com.azure.storage.file.models.ShareSnapshotInfo; -import com.azure.storage.file.models.ShareStatistics; -import com.azure.storage.file.models.SignedIdentifier; -import com.azure.storage.file.models.StorageErrorException; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -/** - * This class provides a client that contains all the operations for interacting with a share in Azure Storage Share. - * Operations allowed by the client are creating and deleting the share, creating snapshots for the share, creating and - * deleting directories in the share and retrieving and updating properties metadata and access policies of the share. - * - *

Instantiating a Synchronous Share Client

- * - *
- * ShareClient client = ShareClient.builder()
- *     .connectionString(connectionString)
- *     .endpoint(endpoint)
- *     .build();
- * 
- * - *

View {@link ShareClientBuilder this} for additional ways to construct the client.

- * - * @see ShareClientBuilder - * @see ShareAsyncClient - * @see SharedKeyCredential - * @see SASTokenCredential - */ -public class ShareClient { - private final ShareAsyncClient client; - - ShareClient(ShareAsyncClient client) { - this.client = client; - } - - /** - * Creates a builder that can configure options for the ShareClient before creating an instance of it. - * - * @return A new {@link ShareClientBuilder} used create ShareClient instances. - */ - public static ShareClientBuilder builder() { - return new ShareClientBuilder(); - } - - /** - * @return the getShareUrl of the storage file service - */ - public String getShareUrl() { - return client.getShareUrl(); - } - - /** - * Constructs a {@link DirectoryClient} that interacts with the root directory in the share. - * - *

If the directory doesn't exist in the share {@link DirectoryClient#create(Map) create} in the client will - * need to be called before interaction with the directory can happen.

- * - * @return a {@link DirectoryClient} that interacts with the root directory in the share - */ - public DirectoryClient getRootDirectoryClient() { - return getDirectoryClient(""); - } - - /** - * Constructs a {@link DirectoryClient} that interacts with the specified directory. - * - *

If the directory doesn't exist in the share {@link DirectoryClient#create(Map) create} in the client will - * need to be called before interaction with the directory can happen.

- * - * @param directoryName Name of the directory - * @return a {@link DirectoryClient} that interacts with the directory in the share - */ - public DirectoryClient getDirectoryClient(String directoryName) { - return new DirectoryClient(client.getDirectoryClient(directoryName)); - } - - /** - * Creates the share in the storage account. - * - *

Code Samples

- * - *

Create the share

- * - * {@codesnippet com.azure.storage.file.shareClient.createShare} - * - * @return A response containing information about the share and the status its creation. - * @throws StorageErrorException If the share already exists with different metadata - */ - public Response create() { - return create(null, null); - } - - /** - * Creates the share in the storage account with the specified metadata and quota. - * - *

Code Samples

- * - *

Create the share with metadata "share:metadata"

- * - *
-     * Response<ShareInfo> response = client.createShare(Collections.singletonMap("share", "metadata"), null);
-     * System.out.printf("Creating the share completed with status code %d", response.statusCode());
-     * 
- * - *

Create the share with a quota of 10 GB

- * - *
-     * Response<ShareInfo> response = client.createShare(null, 10);
-     * System.out.printf("Creating the share completed with status code %d", response.statusCode());
-     * 
- * - * @param metadata Optional. Metadata to associate with the share - * @param quotaInGB Optional. Maximum size the share is allowed to grow to in GB. This must be greater than 0 and - * less than or equal to 5120. The default value is 5120. - * @return A response containing information about the share and the status its creation. - * @throws StorageErrorException If the share already exists with different metadata or {@code quotaInGB} is outside the - * allowed range. - */ - public Response create(Map metadata, Integer quotaInGB) { - return client.create(metadata, quotaInGB).block(); - } - - /** - * Creates a snapshot of the share with the same metadata associated to the share at the time of creation. - * - *

Code Samples

- * - *

Create a snapshot

- * - * {@codesnippt com.azure.storage.file.shareClient.createSnapshot} - * - * @return A response containing information about the snapshot of share. - * @throws StorageErrorException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is - * in progress for the share - */ - public Response createSnapshot() { - return createSnapshot(null); - } - - /** - * Creates a snapshot of the share with the metadata that was passed associated to the snapshot. - * - *

Code Samples

- * - *

Create a snapshot with metadata "snapshot:metadata"

- * - *
-     * Response<ShareSnapshotInfo> response = client.createShare(Collections.singletonMap("snapshot", "metadata"));
-     * System.out.printf("Snapshot %s was created", response.value().snapshot());
-     * 
- * - * @param metadata Optional. Metadata to associate with the snapshot. If {@code null} the metadata of the share - * will be copied to the snapshot. - * @return A response containing information about the snapshot of share. - * @throws StorageErrorException If the share doesn't exist, there are 200 snapshots of the share, or a snapshot is - * in progress for the share - */ - public Response createSnapshot(Map metadata) { - return client.createSnapshot(metadata).block(); - } - - /** - * Deletes the share in the storage account - * - *

Code Samples

- * - *

Delete the share

- * - * {@codesnippet com.azure.storage.file.shareClient.delete} - * - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist - */ - public VoidResponse delete() { - return delete(null); - } - - /** - * Deletes the specific snapshot of the share in the storage account. Snapshot are identified by the time they - * were created. - * - *

Code Samples

- * - *

Delete the snapshot of share that was created at midnight

- * - *
-     * OffsetDateTime midnight = OffsetDateTime.of(LocalTime.MIDNIGHT, ZoneOffset.UTC));
-     * VoidResponse response = client.deleteShare(midnight.toString());
-     * System.out.printf("Deleting the snapshot completed with status code %d", response.statusCode());
-     * 
- * - * @param shareSnapshot Identifier of the snapshot - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist or the snapshot doesn't exist - */ - public VoidResponse delete(String shareSnapshot) { - return client.delete(shareSnapshot).block(); - } - - /** - * Retrieves the properties of the share, these include the metadata associated to it and the quota that the share - * is restricted to. - * - *

Code Samples

- * - *

Retrieve the share properties

- * - *
-     * ShareProperties properties = client.getProperties().value();
-     * System.out.printf("Share quota: %d, Metadata: %s", properties.quota(), properties.metadata());
-     * 
- * - * @return the properties of the share - * @throws StorageErrorException If the share doesn't exist - */ - public Response getProperties() { - return getProperties(null); - } - - /** - * Retrieves the properties of a specific snapshot of the share, these include the metadata associated to it and - * the quota that the share is restricted to. - * - *

Code Samples

- * - *

Retrieve the properties from the snapshot at midnight

- * - *
-     * OffsetDateTime midnight = OffsetDateTime.of(LocalTime.MIDNIGHT, ZoneOffset.UTC));
-     * ShareProperties properties = client.getProperties(midnight.toString()).value();
-     * System.out.printf("Share quota: %d, Metadata: %s", properties.quota(), properties.metadata());
-     * 
- * - * @param shareSnapshot Identifier of the snapshot - * @return the properties of the share snapshot - * @throws StorageErrorException If the share or snapshot doesn't exist - */ - public Response getProperties(String shareSnapshot) { - return client.getProperties(shareSnapshot).block(); - } - - /** - * Sets the maximum size in GB that the share is allowed to grow. - * - *

Code Samples

- * - *

Set the quota to 1024 GB

- * - *
-     * Response<ShareInfo> response = client.setQuota(1024);
-     * System.out.printf("Setting the share quota completed with status code %d", response.statusCode());
-     * 
- * - * @param quotaInGB Size in GB to limit the share's growth. The quota in GB must be between 1 and 5120. - * @return information about the share - * @throws StorageErrorException If the share doesn't exist or {@code quotaInGB} is outside the allowed bounds - */ - public Response setQuota(int quotaInGB) { - return client.setQuota(quotaInGB).block(); - } - - /** - * Sets the user-defined metadata to associate to the share. - * - *

If {@code null} is passed for the metadata it will clear the metadata associated to the share.

- * - *

Code Samples

- * - *

Set the metadata to "share:updatedMetadata"

- * - *
-     * Response<ShareInfo> response = client.setMetadata(Collections.singletonMap("share", "updatedMetadata"));
-     * System.out.printf("Setting the share metadata completed with status code %d", response.statusCode());
-     * 
- * - *

Clear the metadata of the share

- * - *
-     * Response<ShareInfo> response = client.setMetadata(null);
-     * System.out.printf("Clearing the share metadata completed with status code %d", response.statusCode());
-     * 
- * - * @param metadata Metadata to set on the share, if null is passed the metadata for the share is cleared - * @return information about the share - * @throws StorageErrorException If the share doesn't exist or the metadata contains invalid keys - */ - public Response setMetadata(Map metadata) { - return client.setMetadata(metadata).block(); - } - - /** - * Retrieves stored access policies specified for the share. - * - *

Code Samples

- * - *

List the stored access policies

- * - *
-     * for (SignedIdentifier result : client.getAccessPolicy()) {
-     *     System.out.printf("Access policy %s allows these permissions: %s", result.id(), result.accessPolicy().permission());
-     * }
-     * 
- * - * @return The stored access policies specified on the queue. - * @throws StorageErrorException If the share doesn't exist - */ - public Iterable getAccessPolicy() { - return client.getAccessPolicy().toIterable(); - } - - /** - * Sets stored access policies for the share. - * - *

Code Samples

- * - *

Set a read only stored access policy

- * - *
-     * AccessPolicy policy = new AccessPolicy().permission("r")
-     *     .start(OffsetDateTime.now(ZoneOffset.UTC))
-     *     .expiry(OffsetDateTime.now(ZoneOffset.UTC).addDays(10));
-     *
-     * SignedIdentifier permission = new SignedIdentifier().id("mypolicy").accessPolicy(accessPolicy);
-     *
-     * Response<ShareInfo> response = client.setAccessPolicy(Collections.singletonList(permission));
-     * System.out.printf("Setting access policies completed with status code %d", response.statusCode());
-     * 
- * - * @param permissions Access policies to set on the queue - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist, a stored access policy doesn't have all fields filled out, - * or the share will have more than five policies. - */ - public Response setAccessPolicy(List permissions) { - List p = Arrays.asList(new SignedIdentifier()); - return client.setAccessPolicy(permissions).block(); - } - - /** - * Retrieves storage statistics about the share. - * - *

Code Samples

- * - *

Retrieve the storage statistics

- * - *
-     * Response<ShareStatistics> response = client.getStatistics();
-     * System.out.printf("The share is using %d GB", response.value().getShareUsageInGB());
-     * 
- * - * @return the storage statistics of the share - */ - public Response getStatistics() { - return client.getStatistics().block(); - } - - /** - * Creates the directory in the share with the given name. - * - *

Code Samples

- * - *

Create the directory "documents"

- * - * {@codesnippet com.azure.storage.file.shareClient.createDirectory} - * - * @param directoryName Name of the directory - * @return A response containing a {@link DirectoryClient} to interact with the created directory and the - * status of its creation. - * @throws StorageErrorException If the share doesn't exist, the directory already exists or is in the process of - * being deleted, or the parent directory for the new directory doesn't exist - */ - public Response createDirectory(String directoryName) { - return createDirectory(directoryName, null); - } - - /** - * Creates the directory in the share with the given name and associates the passed metadata to it. - * - *

Code Samples

- * - *

Create the directory "documents" with metadata "directory:metadata"

- * - *
-     * Response<DirectoryClient> response = client.createDirectory("documents", Collections.singletonMap("directory", "metadata"));
-     * System.out.printf("Creating the directory completed with status code %d", response.statusCode());
-     * 
- * - * @param directoryName Name of the directory - * @param metadata Optional. Metadata to associate with the directory - * @return A response containing a {@link DirectoryAsyncClient} to interact with the created directory and the - * status of its creation. - * @throws StorageErrorException If the share doesn't exist, the directory already exists or is in the process of - * being deleted, the parent directory for the new directory doesn't exist, or the metadata is using an illegal - * key name - */ - public Response createDirectory(String directoryName, Map metadata) { - return client.createDirectory(directoryName, metadata).map(response -> DirectoryAsyncClient.mapResponse(response, new DirectoryClient(response.value()))).block(); - } - - /** - * Deletes the specified directory in the share. - * - *

Code Samples

- * - *

Delete the directory "empty"

- * - * {@codesnippet com.azure.storage.file.shareClient.deleteDirectory#string} - * - * @param directoryName Name of the directory - * @return A response that only contains headers and response status code - * @throws StorageErrorException If the share doesn't exist or the directory isn't empty - */ - public VoidResponse deleteDirectory(String directoryName) { - return client.deleteDirectory(directoryName).block(); - } - -} diff --git a/storage/client/src/main/java/com/azure/storage/file/ShareClientBuilder.java b/storage/client/src/main/java/com/azure/storage/file/ShareClientBuilder.java deleted file mode 100644 index 1a55c0842f860..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/ShareClientBuilder.java +++ /dev/null @@ -1,340 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.policy.AddDatePolicy; -import com.azure.core.http.policy.HttpLogDetailLevel; -import com.azure.core.http.policy.HttpLoggingPolicy; -import com.azure.core.http.policy.HttpPipelinePolicy; -import com.azure.core.http.policy.RequestIdPolicy; -import com.azure.core.http.policy.RetryPolicy; -import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.implementation.http.policy.spi.HttpPolicyProviders; -import com.azure.core.util.configuration.Configuration; -import com.azure.core.util.configuration.ConfigurationManager; -import com.azure.storage.common.credentials.SASTokenCredential; -import com.azure.storage.common.credentials.SharedKeyCredential; -import com.azure.storage.common.policy.SASTokenCredentialPolicy; -import com.azure.storage.common.policy.SharedKeyCredentialPolicy; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -/** - * This class provides a fluent builder API to help aid the configuration and instantiation of the {@link ShareClient ShareClients} - * and {@link ShareAsyncClient SahreAsyncClients}, calling {@link ShareClientBuilder#build() build} - * constructs an instance of ShareClient and calling {@link ShareClientBuilder#buildAsync() buildAsync} - * constructs an instance of SahreAsyncClient. - * - *

The client needs the endpoint of the Azure Storage File service, name of the share, and authorization credential. - * {@link ShareClientBuilder#endpoint(String) endpoint} gives the builder the endpoint and may give the builder the - * {@link ShareClientBuilder#shareName(String) shareName} and a {@link SASTokenCredential} that authorizes the client.

- * - *

Instantiating a synchronous Share Client with SAS token

- * {@codesnippet com.azure.storage.file.shareClient.instantiation.sastoken} - * - *

Instantiating an Asynchronous Share Client with SAS token

- * {@codesnippet com.azure.storage.file.shareAsyncClient.instantiation.sastoken} - * - *

If the {@code endpoint} doesn't contain the query parameters to construct a {@code SASTokenCredential} they may - * be set using {@link ShareClientBuilder#credential(SASTokenCredential) credential}.

- * - *
- * ShareClient client = ShareClient.builder()
- *     .endpoint(endpointWithoutSASTokenQueryParams)
- *     .shareName(shareName)
- *     .credential(SASTokenCredential.fromQuery(SASTokenQueryParams))
- *     .build();
- * 
- * - *
- * ShareAsyncClient client = ShareAsyncClient.builder()
- *     .endpoint(endpointWithoutSASTokenQueryParams)
- *     .shareName(shareName)
- *     .credential(SASTokenCredential.fromQuery(SASTokenQueryParams))
- *     .buildAsync();
- * 
- * - *

Another way to authenticate the client is using a {@link SharedKeyCredential}. To create a SharedKeyCredential - * a connection string from the Storage File service must be used. Set the SharedKeyCredential with - * {@link ShareClientBuilder#connectionString(String) connectionString}. If the builder has both a SASTokenCredential and - * SharedKeyCredential the SharedKeyCredential will be preferred when authorizing requests sent to the service.

- * - *

Instantiating a synchronous Share Client with connection string.

- * {@codesnippet com.azure.storage.file.shareClient.instantiation.connectionstring} - * - *

Instantiating an Asynchronous Share Client with connection string.

- * {@codesnippet com.azure.storage.file.shareAsyncClient.instantiation.connectionstring} - * - * @see ShareClient - * @see ShareAsyncClient - * @see SASTokenCredential - * @see SharedKeyCredential - */ -public class ShareClientBuilder { - private static final String ACCOUNT_NAME = "AccountName".toLowerCase(); - private final List policies; - - private URL endpoint; - private SASTokenCredential sasTokenCredential; - private SharedKeyCredential sharedKeyCredential; - private String shareName; - private String shareSnapshot; - private HttpClient httpClient; - private HttpPipeline pipeline; - private HttpLogDetailLevel logLevel; - private RetryPolicy retryPolicy; - private Configuration configuration; - - ShareClientBuilder() { - retryPolicy = new RetryPolicy(); - logLevel = HttpLogDetailLevel.NONE; - policies = new ArrayList<>(); - configuration = ConfigurationManager.getConfiguration(); - } - - /** - * Creates a {@link ShareAsyncClient} based on options set in the builder. Every time {@code buildAsync()} is - * called a new instance of {@link ShareAsyncClient} is created. - * - *

- * If {@link ShareClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and - * {@link ShareClientBuilder#endpoint(String) endpoint} are used to create the - * {@link ShareAsyncClient client}. All other builder settings are ignored. - *

- * - * @return A ShareAsyncClient with the options set from the builder. - * @throws NullPointerException If {@code endpoint} or {@code shareName} is {@code null}. - * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. - */ - public ShareAsyncClient buildAsync() { - Objects.requireNonNull(endpoint); - Objects.requireNonNull(shareName); - - if (pipeline != null) { - return new ShareAsyncClient(endpoint, pipeline, shareName, shareSnapshot); - } - - if (sasTokenCredential == null && sharedKeyCredential == null) { - throw new IllegalArgumentException("Credentials are required for authorization"); - } - - // Closest to API goes first, closest to wire goes last. - final List policies = new ArrayList<>(); - - policies.add(new UserAgentPolicy(FileConfiguration.NAME, FileConfiguration.VERSION, configuration)); - policies.add(new RequestIdPolicy()); - policies.add(new AddDatePolicy()); - - if (sharedKeyCredential != null) { - policies.add(new SharedKeyCredentialPolicy(sharedKeyCredential)); - } else { - policies.add(new SASTokenCredentialPolicy(sasTokenCredential)); - } - - HttpPolicyProviders.addBeforeRetryPolicies(policies); - - policies.add(retryPolicy); - - policies.addAll(this.policies); - HttpPolicyProviders.addAfterRetryPolicies(policies); - policies.add(new HttpLoggingPolicy(logLevel)); - - HttpPipeline pipeline = HttpPipeline.builder() - .policies(policies.toArray(new HttpPipelinePolicy[0])) - .httpClient(httpClient) - .build(); - - return new ShareAsyncClient(endpoint, pipeline, shareName, shareSnapshot); - } - - /** - * Creates a {@link ShareClient} based on options set in the builder. Every time {@code build()} is - * called a new instance of {@link ShareClient} is created. - * - *

- * If {@link ShareClientBuilder#pipeline(HttpPipeline) pipeline} is set, then the {@code pipeline} and - * {@link ShareClientBuilder#endpoint(String) endpoint} are used to create the - * {@link ShareClient client}. All other builder settings are ignored. - *

- * - * @return A ShareClient with the options set from the builder. - * @throws NullPointerException If {@code endpoint} or {@code shareName} is {@code null}. - * @throws IllegalStateException If neither a {@link SharedKeyCredential} or {@link SASTokenCredential} has been set. - */ - public ShareClient build() { - return new ShareClient(buildAsync()); - } - - /** - * Sets the endpoint for the Azure Storage File instance that the client will interact with. - * - *

The first path segment, if the endpoint contains path segments, will be assumed to be the name of the share - * that the client will interact with.

- * - *

Query parameters of the endpoint will be parsed using {@link SASTokenCredential#(String) fromQuery} in an - * attempt to generate a {@link SASTokenCredential} to authenticate requests sent to the service.

- * - * @param endpoint The URL of the Azure Storage File instance to send service requests to and receive responses from. - * @return the updated ShareClientBuilder object - * @throws IllegalArgumentException If {@code endpoint} is {@code null} or is an invalid URL - */ - public ShareClientBuilder endpoint(String endpoint) { - Objects.requireNonNull(endpoint); - try { - URL fullURL = new URL(endpoint); - this.endpoint = new URL(fullURL.getProtocol() + "://" + fullURL.getHost()); - - // Attempt to get the SAS token from the URL passed - SASTokenCredential credential = SASTokenCredential.fromQuery(fullURL.getQuery()); - if (credential != null) { - this.sasTokenCredential = credential; - } - } catch (MalformedURLException ex) { - throw new IllegalArgumentException("The Azure Storage File Service endpoint url is malformed."); - } - - return this; - } - - /** - * Sets the {@link SASTokenCredential} used to authenticate requests sent to the File service. - * - * @param credential SAS token credential generated from the Storage account that authorizes requests - * @return the updated ShareClientBuilder object - * @throws NullPointerException If {@code credential} is {@code null}. - */ - public ShareClientBuilder credential(SASTokenCredential credential) { - this.sasTokenCredential = Objects.requireNonNull(credential); - return this; - } - - /** - * Creates a {@link SharedKeyCredential} from the {@code connectionString} used to authenticate requests sent to the - * File service. - * - * @param connectionString Connection string from the Access Keys section in the Storage account - * @return the updated ShareClientBuilder object - * @throws NullPointerException If {@code connectionString} is {@code null}. - */ - public ShareClientBuilder connectionString(String connectionString) { - Objects.requireNonNull(connectionString); - this.sharedKeyCredential = SharedKeyCredential.fromConnectionString(connectionString); - getEndPointFromConnectionString(connectionString); - return this; - } - - private void getEndPointFromConnectionString(String connectionString) { - Map connectionStringPieces = new HashMap<>(); - for (String connectionStringPiece : connectionString.split(";")) { - String[] kvp = connectionStringPiece.split("=", 2); - connectionStringPieces.put(kvp[0].toLowerCase(), kvp[1]); - } - String accountName = connectionStringPieces.get(ACCOUNT_NAME); - try { - this.endpoint = new URL(String.format("https://%s.file.core.windows.net", accountName)); - } catch (MalformedURLException e) { - throw new IllegalArgumentException(String.format("There is no valid endpoint for the connection string. " + - "Connection String: %s", connectionString)); - } - } - - /** - * Sets the share that the constructed clients will interact with - * - * @param shareName Name of the share - * @return the updated ShareClientBuilder object - * @throws NullPointerException If {@code shareName} is {@code null}. - */ - public ShareClientBuilder shareName(String shareName) { - this.shareName = Objects.requireNonNull(shareName); - return this; - } - - /** - * Sets the snapshot that the constructed clients will interact with. This snapshot must be linked to the share - * that has been specified in the builder. - * - * @param shareSnapshot Identifier of the snapshot - * @return the updated ShareClientBuilder object - * @throws NullPointerException If {@code shareSnapshot} is {@code null}. - */ - public ShareClientBuilder shareSnapshot(String shareSnapshot) { - this.shareSnapshot = Objects.requireNonNull(shareSnapshot); - return this; - } - - /** - * Sets the HTTP client to use for sending and receiving requests to and from the service. - * - * @param httpClient The HTTP client to use for requests. - * @return The updated ShareClientBuilder object. - * @throws NullPointerException If {@code httpClient} is {@code null}. - */ - public ShareClientBuilder httpClient(HttpClient httpClient) { - this.httpClient = Objects.requireNonNull(httpClient); - return this; - } - - /** - * Adds a policy to the set of existing policies that are executed after the {@link RetryPolicy}. - * - * @param pipelinePolicy The retry policy for service requests. - * @return The updated ShareClientBuilder object. - * @throws NullPointerException If {@code pipelinePolicy} is {@code null}. - */ - public ShareClientBuilder addPolicy(HttpPipelinePolicy pipelinePolicy) { - Objects.requireNonNull(pipelinePolicy); - this.policies.add(pipelinePolicy); - return this; - } - - /** - * Sets the logging level for HTTP requests and responses. - * - * @param logLevel The amount of logging output when sending and receiving HTTP requests/responses. - * @return The updated ShareClientBuilder object. - */ - public ShareClientBuilder httpLogDetailLevel(HttpLogDetailLevel logLevel) { - this.logLevel = logLevel; - return this; - } - - /** - * Sets the HTTP pipeline to use for the service client. - * - *

If {@code pipeline} is set, all other settings are ignored, aside from {@link ShareClientBuilder#endpoint(String) endpoint}, - * {@link ShareClientBuilder#shareName(String) shareName}, and {@link ShareClientBuilder#shareSnapshot(String) snaphotShot} - * when building clients.

- * - * @param pipeline The HTTP pipeline to use for sending service requests and receiving responses. - * @return The updated ShareClientBuilder object. - * @throws NullPointerException If {@code pipeline} is {@code null}. - */ - public ShareClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = Objects.requireNonNull(pipeline); - return this; - } - - /** - * Sets the configuration store that is used during construction of the service client. - * - * The default configuration store is a clone of the {@link ConfigurationManager#getConfiguration() global - * configuration store}, use {@link Configuration#NONE} to bypass using configuration settings during construction. - * - * @param configuration The configuration store used to - * @return The updated ShareClientBuilder object. - * @throws NullPointerException If {@code configuration} is {@code null}. - */ - public ShareClientBuilder configuration(Configuration configuration) { - this.configuration = Objects.requireNonNull(configuration); - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/implementation/AzureFileStorageBuilder.java b/storage/client/src/main/java/com/azure/storage/file/implementation/AzureFileStorageBuilder.java deleted file mode 100644 index 6dced97e93c08..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/implementation/AzureFileStorageBuilder.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.implementation.RestProxy; - -/** - * A appendBlobClientBuilder for creating a new instance of the AzureFileStorage type. - */ -public final class AzureFileStorageBuilder { - /* - * Specifies the version of the operation to use for this request. - */ - private String version; - - /** - * Sets Specifies the version of the operation to use for this request. - * - * @param version the version value. - * @return the AzureFileStorageBuilder. - */ - public AzureFileStorageBuilder version(String version) { - this.version = version; - return this; - } - - /* - * The URL of the service account, share, directory or file that is the target of the desired operation. - */ - private String url; - - /** - * Sets The URL of the service account, share, directory or file that is the target of the desired operation. - * - * @param url the url value. - * @return the AzureFileStorageBuilder. - */ - public AzureFileStorageBuilder url(String url) { - this.url = url; - return this; - } - - /* - * The HTTP pipeline to send requests through - */ - private HttpPipeline pipeline; - - /** - * Sets The HTTP pipeline to send requests through. - * - * @param pipeline the pipeline value. - * @return the AzureFileStorageBuilder. - */ - public AzureFileStorageBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; - return this; - } - - /** - * Builds an instance of AzureFileStorageImpl with the provided parameters. - * - * @return an instance of AzureFileStorageImpl. - */ - public AzureFileStorageImpl build() { - if (version == null) { - this.version = "2018-11-09"; - } - if (pipeline == null) { - this.pipeline = RestProxy.createDefaultPipeline(); - } - AzureFileStorageImpl client = new AzureFileStorageImpl(pipeline); - if (this.version != null) { - client.version(this.version); - } - if (this.url != null) { - client.url(this.url); - } - return client; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/implementation/AzureFileStorageImpl.java b/storage/client/src/main/java/com/azure/storage/file/implementation/AzureFileStorageImpl.java deleted file mode 100644 index 883c519214881..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/implementation/AzureFileStorageImpl.java +++ /dev/null @@ -1,165 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.implementation; - -import com.azure.core.http.HttpPipeline; -import com.azure.core.implementation.RestProxy; -import com.azure.core.implementation.annotation.ServiceClient; - -/** - * Initializes a new instance of the AzureFileStorage type. - */ -@ServiceClient(builder = AzureFileStorageBuilder.class, serviceInterfaces = {ServicesImpl.class, SharesImpl.class, DirectorysImpl.class, FilesImpl.class}) -public final class AzureFileStorageImpl{ - /** - * Specifies the version of the operation to use for this request. - */ - private String version; - - /** - * Gets Specifies the version of the operation to use for this request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Sets Specifies the version of the operation to use for this request. - * - * @param version the version value. - * @return the service client itself. - */ - AzureFileStorageImpl version(String version) { - this.version = version; - return this; - } - - /** - * The URL of the service account, share, directory or file that is the target of the desired operation. - */ - private String url; - - /** - * Gets The URL of the service account, share, directory or file that is the target of the desired operation. - * - * @return the url value. - */ - public String url() { - return this.url; - } - - /** - * Sets The URL of the service account, share, directory or file that is the target of the desired operation. - * - * @param url the url value. - * @return the service client itself. - */ - AzureFileStorageImpl url(String url) { - this.url = url; - return this; - } - - /** - * The HttpPipeline of the service account, share, directory or file that is the target of the desired operation. - */ - private HttpPipeline httpPipeline; - - /** - * Gets The HttpPipeline of the service account, share, directory or file that is the target of the desired operation. - * - * @return the httpPipeline object. - */ - public HttpPipeline httpPipeline() { - return this.httpPipeline; - } - - /** - * Sets The HttpPipeline of the service account, share, directory or file that is the target of the desired operation. - * - * @param httpPipeline the httpPipeline object. - * @return the service client itself. - */ - AzureFileStorageImpl httpPipeline(HttpPipeline httpPipeline) { - this.httpPipeline = httpPipeline; - return this; - } - /** - * The ServicesImpl object to access its operations. - */ - private ServicesImpl services; - - /** - * Gets the ServicesImpl object to access its operations. - * - * @return the ServicesImpl object. - */ - public ServicesImpl services() { - return this.services; - } - - /** - * The SharesImpl object to access its operations. - */ - private SharesImpl shares; - - /** - * Gets the SharesImpl object to access its operations. - * - * @return the SharesImpl object. - */ - public SharesImpl shares() { - return this.shares; - } - - /** - * The DirectorysImpl object to access its operations. - */ - private DirectorysImpl directorys; - - /** - * Gets the DirectorysImpl object to access its operations. - * - * @return the DirectorysImpl object. - */ - public DirectorysImpl directorys() { - return this.directorys; - } - - /** - * The FilesImpl object to access its operations. - */ - private FilesImpl files; - - /** - * Gets the FilesImpl object to access its operations. - * - * @return the FilesImpl object. - */ - public FilesImpl files() { - return this.files; - } - - /** - * Initializes an instance of AzureFileStorage client. - */ - public AzureFileStorageImpl() { - this(RestProxy.createDefaultPipeline()); - } - - /** - * Initializes an instance of AzureFileStorage client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - */ - public AzureFileStorageImpl(HttpPipeline httpPipeline) { - this.httpPipeline = httpPipeline; - this.services = new ServicesImpl(this); - this.shares = new SharesImpl(this); - this.directorys = new DirectorysImpl(this); - this.files = new FilesImpl(this); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/implementation/DirectorysImpl.java b/storage/client/src/main/java/com/azure/storage/file/implementation/DirectorysImpl.java deleted file mode 100644 index da621907cf7c3..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/implementation/DirectorysImpl.java +++ /dev/null @@ -1,396 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.implementation; - -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.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.ServiceInterface; -import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType; -import com.azure.core.util.Context; -import com.azure.storage.file.models.DirectorysCreateResponse; -import com.azure.storage.file.models.DirectorysDeleteResponse; -import com.azure.storage.file.models.DirectorysForceCloseHandlesResponse; -import com.azure.storage.file.models.DirectorysGetPropertiesResponse; -import com.azure.storage.file.models.DirectorysListFilesAndDirectoriesSegmentResponse; -import com.azure.storage.file.models.DirectorysListHandlesResponse; -import com.azure.storage.file.models.DirectorysSetMetadataResponse; -import com.azure.storage.file.models.FilesDeleteResponse; -import com.azure.storage.file.models.StorageErrorException; -import reactor.core.publisher.Mono; -import java.util.Map; - -/** - * An instance of this class provides access to all the operations defined in - * Directorys. - */ -public final class DirectorysImpl { - /** - * The proxy service used to perform REST calls. - */ - private DirectorysService service; - - /** - * The service client containing this operation class. - */ - private AzureFileStorageImpl client; - - /** - * Initializes an instance of DirectorysImpl. - * - * @param client the instance of the service client containing this operation class. - */ - public DirectorysImpl(AzureFileStorageImpl client) { - this.service = RestProxy.create(DirectorysService.class, client.httpPipeline()); - this.client = client; - } - - /** - * The interface defining all the services for Directorys to be used by the - * proxy service to perform REST calls. - */ - @Host("{url}") - @ServiceInterface(name = "Storage File Directories") - private interface DirectorysService { - @Put("{shareName}/{directory}") - @ExpectedResponses({201}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono create(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("directory") String directoryName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); - - @Get("{shareName}/{directory}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getProperties(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("directory") String directoryName, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); - - @Delete("{shareName}/{directory}") - @ExpectedResponses({202}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono delete(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("directory") String directoryName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); - - @Delete("{shareName}/{directory}/{fileName}") - @ExpectedResponses({202}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono delete(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("directory") String directoryName, @PathParam("fileName") String fileName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); - - @Put("{shareName}/{directory}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setMetadata(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("directory") String directoryName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); - - @Get("{shareName}/{directory}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono listFilesAndDirectoriesSegment(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("directory") String directoryName, @QueryParam("prefix") String prefix, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); - - @Get("{shareName}/{directory}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono listHandles(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("directory") String directoryName, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("timeout") Integer timeout, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-recursive") Boolean recursive, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); - - @Put("{shareName}/{directory}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono forceCloseHandles(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("directory") String directoryName, @QueryParam("timeout") Integer timeout, @QueryParam("marker") String marker, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-handle-id") String handleId, @HeaderParam("x-ms-recursive") Boolean recursive, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); - } - - /** - * Creates a new directory under the specified share or parent directory. - * - * @param shareName Name of the share. - * @param directoryName Path to the directory. - * @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. - */ - public Mono createWithRestResponseAsync(String shareName, String directoryName, Context context) { - final Integer timeout = null; - final Map metadata = null; - final String restype = "directory"; - return service.create(this.client.url(), shareName, directoryName, timeout, metadata, this.client.version(), restype, context); - } - - /** - * Creates a new directory under the specified share or parent directory. - * - * @param shareName Name of the share. - * @param directoryName Path to the directory. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param metadata A name-value pair to associate with a file storage object. - * @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. - */ - public Mono createWithRestResponseAsync(String shareName, String directoryName, Integer timeout, Map metadata, Context context) { - final String restype = "directory"; - return service.create(this.client.url(), shareName, directoryName, timeout, metadata, this.client.version(), restype, context); - } - - /** - * Creates a new directory under the specified share or parent directory. - * - * @param shareName Name of the share. - * @param directoryName Path to the directory. - * @param metadata A name-value pair to associate with a file storage object. - * @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. - */ - public Mono createSubDirectoryWithRestResponseAsync(String shareName, String directoryName, Map metadata, Context context) { - final Integer timeout = null; - final String restype = "directory"; - return service.create(this.client.url(), shareName, directoryName, timeout, metadata, this.client.version(), restype, context); - } - - /** - * Returns all system properties for the specified directory, and can also be used to check the existence of a directory. The data returned does not include the files in the directory or any subdirectories. - * - * @param shareName Name of the share. - * @param directoryName Path to the directory. - * @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. - */ - public Mono getPropertiesWithRestResponseAsync(String shareName, String directoryName, Context context) { - final String sharesnapshot = null; - final Integer timeout = null; - final String restype = "directory"; - return service.getProperties(this.client.url(), shareName, directoryName, sharesnapshot, timeout, this.client.version(), restype, context); - } - - /** - * Returns all system properties for the specified directory, and can also be used to check the existence of a directory. The data returned does not include the files in the directory or any subdirectories. - * - * @param shareName Name of the share. - * @param directoryName Path to the directory. - * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @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. - */ - public Mono getPropertiesWithRestResponseAsync(String shareName, String directoryName, String sharesnapshot, Integer timeout, Context context) { - final String restype = "directory"; - return service.getProperties(this.client.url(), shareName, directoryName, sharesnapshot, timeout, this.client.version(), restype, context); - } - - /** - * Removes the specified empty directory. Note that the directory must be empty before it can be deleted. - * - * @param shareName Name of the share. - * @param directoryName Path to the directory. - * @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. - */ - public Mono deleteWithRestResponseAsync(String shareName, String directoryName, Context context) { - final Integer timeout = null; - final String restype = "directory"; - return service.delete(this.client.url(), shareName, directoryName, timeout, this.client.version(), restype, context); - } - - /** - * Removes the specified empty directory. Note that the directory must be empty before it can be deleted. - * - * @param shareName Name of the share. - * @param directoryName Path to the directory. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @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. - */ - public Mono deleteWithRestResponseAsync(String shareName, String directoryName, Integer timeout, Context context) { - final String restype = "directory"; - return service.delete(this.client.url(), shareName, directoryName, timeout, this.client.version(), restype, context); - } - - - /** - * Removes the specified empty directory. Note that the directory must be empty before it can be deleted. - * - * @param shareName Name of the share. - * @param directoryName Path to the directory. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @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. - */ - public Mono deleteSubWithRestResponseAsync(String shareName, String directoryName, Integer timeout, Context context) { - final String restype = "directory"; - return service.delete(this.client.url(), shareName, directoryName, timeout, this.client.version(), restype, context); - } - - /** - * Removes the specified file. - * - * @param shareName Name of the share. - * @param directoryName Path to the directory. - * @param fileName Name of the file. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @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. - */ - public Mono deleteFileWithRestResponseAsync(String shareName, String directoryName, String fileName, Integer timeout, Context context) { - final String restype = "directory"; - return service.delete(this.client.url(), shareName, directoryName, fileName, timeout, this.client.version(), restype, context); - } - - /** - * Updates user defined metadata for the specified directory. - * - * @param shareName Name of the share. - * @param directoryName Path to the directory. - * @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. - */ - public Mono setMetadataWithRestResponseAsync(String shareName, String directoryName, Context context) { - final Integer timeout = null; - final Map metadata = null; - final String restype = "directory"; - final String comp = "metadata"; - return service.setMetadata(this.client.url(), shareName, directoryName, timeout, metadata, this.client.version(), restype, comp, context); - } - - /** - * Updates user defined metadata for the specified directory. - * - * @param shareName Name of the share. - * @param directoryName Path to the directory. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param metadata A name-value pair to associate with a file storage object. - * @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. - */ - public Mono setMetadataWithRestResponseAsync(String shareName, String directoryName, Integer timeout, Map metadata, Context context) { - final String restype = "directory"; - final String comp = "metadata"; - return service.setMetadata(this.client.url(), shareName, directoryName, timeout, metadata, this.client.version(), restype, comp, context); - } - - /** - * Returns a list of files or directories under the specified share or directory. It lists the contents only for a single level of the directory hierarchy. - * - * @param shareName Name of the share. - * @param directoryName Path to the directory. - * @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. - */ - public Mono listFilesAndDirectoriesSegmentWithRestResponseAsync(String shareName, String directoryName, Context context) { - final String prefix = null; - final String sharesnapshot = null; - final String marker = null; - final Integer maxresults = null; - final Integer timeout = null; - final String restype = "directory"; - final String comp = "list"; - return service.listFilesAndDirectoriesSegment(this.client.url(), shareName, directoryName, prefix, sharesnapshot, marker, maxresults, timeout, this.client.version(), restype, comp, context); - } - - /** - * Returns a list of files or directories under the specified share or directory. It lists the contents only for a single level of the directory hierarchy. - * - * @param shareName Name of the share. - * @param directoryName Path to the directory. - * @param prefix Filters the results to return only entries whose name begins with the specified prefix. - * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - * @param marker A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque to the client. - * @param maxresults Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000 items. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @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. - */ - public Mono listFilesAndDirectoriesSegmentWithRestResponseAsync(String shareName, String directoryName, String prefix, String sharesnapshot, String marker, Integer maxresults, Integer timeout, Context context) { - final String restype = "directory"; - final String comp = "list"; - return service.listFilesAndDirectoriesSegment(this.client.url(), shareName, directoryName, prefix, sharesnapshot, marker, maxresults, timeout, this.client.version(), restype, comp, context); - } - - /** - * Lists handles for directory. - * - * @param shareName Name of the share. - * @param directoryName Path to the directory. - * @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. - */ - public Mono listHandlesWithRestResponseAsync(String shareName, String directoryName, Context context) { - final String marker = null; - final Integer maxresults = null; - final Integer timeout = null; - final String sharesnapshot = null; - final Boolean recursive = null; - final String comp = "listhandles"; - return service.listHandles(this.client.url(), shareName, directoryName, marker, maxresults, timeout, sharesnapshot, recursive, this.client.version(), comp, context); - } - - /** - * Lists handles for directory. - * - * @param shareName Name of the share. - * @param directoryName Path to the directory. - * @param marker A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque to the client. - * @param maxresults Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000 items. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - * @param recursive Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. - * @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. - */ - public Mono listHandlesWithRestResponseAsync(String shareName, String directoryName, String marker, Integer maxresults, Integer timeout, String sharesnapshot, Boolean recursive, Context context) { - final String comp = "listhandles"; - return service.listHandles(this.client.url(), shareName, directoryName, marker, maxresults, timeout, sharesnapshot, recursive, this.client.version(), comp, context); - } - - /** - * Closes all handles open for given directory. - * - * @param shareName Name of the share. - * @param directoryName Path to the directory. - * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterix (‘*’) is a wildcard that specifies all handles. - * @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. - */ - public Mono forceCloseHandlesWithRestResponseAsync(String shareName, String directoryName, String handleId, Context context) { - final Integer timeout = null; - final String marker = null; - final String sharesnapshot = null; - final Boolean recursive = null; - final String comp = "forceclosehandles"; - return service.forceCloseHandles(this.client.url(), shareName, directoryName, timeout, marker, sharesnapshot, handleId, recursive, this.client.version(), comp, context); - } - - /** - * Closes all handles open for given directory. - * - * @param shareName Name of the share. - * @param directoryName Path to the directory. - * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterix (‘*’) is a wildcard that specifies all handles. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param marker A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque to the client. - * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - * @param recursive Specifies operation should apply to the directory specified in the URI, its files, its subdirectories and their files. - * @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. - */ - public Mono forceCloseHandlesWithRestResponseAsync(String shareName, String directoryName, String handleId, Integer timeout, String marker, String sharesnapshot, Boolean recursive, Context context) { - final String comp = "forceclosehandles"; - return service.forceCloseHandles(this.client.url(), shareName, directoryName, timeout, marker, sharesnapshot, handleId, recursive, this.client.version(), comp, context); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/implementation/FilesImpl.java b/storage/client/src/main/java/com/azure/storage/file/implementation/FilesImpl.java deleted file mode 100644 index c49668aba8e8c..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/implementation/FilesImpl.java +++ /dev/null @@ -1,601 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.implementation; - -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.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.ServiceInterface; -import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType; -import com.azure.core.implementation.util.Base64Util; -import com.azure.core.util.Context; -import com.azure.storage.file.models.FileHTTPHeaders; -import com.azure.storage.file.models.FileRangeWriteType; -import com.azure.storage.file.models.FilesAbortCopyResponse; -import com.azure.storage.file.models.FilesCreateResponse; -import com.azure.storage.file.models.FilesDeleteResponse; -import com.azure.storage.file.models.FilesDownloadResponse; -import com.azure.storage.file.models.FilesForceCloseHandlesResponse; -import com.azure.storage.file.models.FilesGetPropertiesResponse; -import com.azure.storage.file.models.FilesGetRangeListResponse; -import com.azure.storage.file.models.FilesListHandlesResponse; -import com.azure.storage.file.models.FilesSetHTTPHeadersResponse; -import com.azure.storage.file.models.FilesSetMetadataResponse; -import com.azure.storage.file.models.FilesStartCopyResponse; -import com.azure.storage.file.models.FilesUploadRangeResponse; -import com.azure.storage.file.models.StorageErrorException; -import io.netty.buffer.ByteBuf; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.util.Map; - -/** - * An instance of this class provides access to all the operations defined in - * Files. - */ -public final class FilesImpl { - /** - * The proxy service used to perform REST calls. - */ - private FilesService service; - - /** - * The service client containing this operation class. - */ - private AzureFileStorageImpl client; - - /** - * Initializes an instance of FilesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - public FilesImpl(AzureFileStorageImpl client) { - this.service = RestProxy.create(FilesService.class, client.httpPipeline()); - this.client = client; - } - - /** - * The interface defining all the services for Files to be used by the - * proxy service to perform REST calls. - */ - @Host("{url}") - @ServiceInterface(name = "Storage File Files") - private interface FilesService { - @Put("{shareName}/{filePath}") - @ExpectedResponses({201}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono create(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-content-length") long fileContentLength, @HeaderParam("x-ms-type") String fileTypeConstant, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-content-type") String fileContentType, @HeaderParam("x-ms-content-encoding") String fileContentEncoding, @HeaderParam("x-ms-content-language") String fileContentLanguage, @HeaderParam("x-ms-cache-control") String fileCacheControl, @HeaderParam("x-ms-content-md5") String fileContentMD5, @HeaderParam("x-ms-content-disposition") String fileContentDisposition, Context context); - - @Get("{shareName}/{filePath}") - @ExpectedResponses({200, 206}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono download(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-range-get-content-md5") Boolean rangeGetContentMD5, Context context); - - @Head("{shareName}/{filePath}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getProperties(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, Context context); - - @Delete("{shareName}/{filePath}") - @ExpectedResponses({202}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono delete(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, Context context); - - @Put("{shareName}/{filePath}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setHTTPHeaders(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-content-length") Long fileContentLength, @QueryParam("comp") String comp, @HeaderParam("x-ms-content-type") String fileContentType, @HeaderParam("x-ms-content-encoding") String fileContentEncoding, @HeaderParam("x-ms-content-language") String fileContentLanguage, @HeaderParam("x-ms-cache-control") String fileCacheControl, @HeaderParam("x-ms-content-md5") String fileContentMD5, @HeaderParam("x-ms-content-disposition") String fileContentDisposition, Context context); - - @Put("{shareName}/{filePath}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setMetadata(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); - - @Put("{shareName}/{filePath}") - @ExpectedResponses({201}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono uploadRange(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @BodyParam("application/octet-stream") Flux optionalbody, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-range") String range, @HeaderParam("x-ms-write") FileRangeWriteType fileRangeWrite, @HeaderParam("Content-Length") long contentLength, @HeaderParam("Content-MD5") String contentMD5, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); - - @Get("{shareName}/{filePath}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getRangeList(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-range") String range, @QueryParam("comp") String comp, Context context); - - @Put("{shareName}/{filePath}") - @ExpectedResponses({202}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono startCopy(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-copy-source") String copySource, Context context); - - @Put("{shareName}/{filePath}") - @ExpectedResponses({204}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono abortCopy(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("copyid") String copyId, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-copy-action") String copyActionAbortConstant, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); - - @Get("{shareName}/{filePath}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono listHandles(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("marker") String marker, @QueryParam("maxresults") Integer maxresults, @QueryParam("timeout") Integer timeout, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); - - @Put("{shareName}/{filePath}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono forceCloseHandles(@HostParam("url") String url, @PathParam("shareName") String shareName, @PathParam("filePath") String filePath, @QueryParam("timeout") Integer timeout, @QueryParam("marker") String marker, @QueryParam("sharesnapshot") String sharesnapshot, @HeaderParam("x-ms-handle-id") String handleId, @HeaderParam("x-ms-version") String version, @QueryParam("comp") String comp, Context context); - } - - /** - * Creates a new file or replaces a file. Note it only initializes the file with no content. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @param fileContentLength Specifies the maximum size for the file, up to 1 TB. - * @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. - */ - public Mono createWithRestResponseAsync(String shareName, String filePath, long fileContentLength, Context context) { - final Integer timeout = null; - final String fileTypeConstant = "file"; - final Map metadata = null; - final String fileContentType = null; - final String fileContentEncoding = null; - final String fileContentLanguage = null; - final String fileCacheControl = null; - final String fileContentDisposition = null; - String fileContentMD5Converted = null; - return service.create(this.client.url(), shareName, filePath, timeout, this.client.version(), fileContentLength, fileTypeConstant, metadata, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); - } - - /** - * Creates a new file or replaces a file. Note it only initializes the file with no content. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @param fileContentLength Specifies the maximum size for the file, up to 1 TB. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param metadata A name-value pair to associate with a file storage object. - * @param fileHTTPHeaders Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - public Mono createWithRestResponseAsync(String shareName, String filePath, long fileContentLength, Integer timeout, Map metadata, FileHTTPHeaders fileHTTPHeaders, Context context) { - final String fileTypeConstant = "file"; - String fileContentType = null; - if (fileHTTPHeaders != null) { - fileContentType = fileHTTPHeaders.fileContentType(); - } - String fileContentEncoding = null; - if (fileHTTPHeaders != null) { - fileContentEncoding = fileHTTPHeaders.fileContentEncoding(); - } - String fileContentLanguage = null; - if (fileHTTPHeaders != null) { - fileContentLanguage = fileHTTPHeaders.fileContentLanguage(); - } - String fileCacheControl = null; - if (fileHTTPHeaders != null) { - fileCacheControl = fileHTTPHeaders.fileCacheControl(); - } - byte[] fileContentMD5 = null; - if (fileHTTPHeaders != null) { - fileContentMD5 = fileHTTPHeaders.fileContentMD5(); - } - String fileContentDisposition = null; - if (fileHTTPHeaders != null) { - fileContentDisposition = fileHTTPHeaders.fileContentDisposition(); - } - String fileContentMD5Converted = Base64Util.encodeToString(fileContentMD5); - return service.create(this.client.url(), shareName, filePath, timeout, this.client.version(), fileContentLength, fileTypeConstant, metadata, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); - } - - /** - * Reads or downloads a file from the system, including its metadata and properties. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @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. - */ - public Mono downloadWithRestResponseAsync(String shareName, String filePath, Context context) { - final Integer timeout = null; - final String range = null; - final Boolean rangeGetContentMD5 = null; - return service.download(this.client.url(), shareName, filePath, timeout, this.client.version(), range, rangeGetContentMD5, context); - } - - /** - * Reads or downloads a file from the system, including its metadata and properties. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param range Return file data only from the specified byte range. - * @param rangeGetContentMD5 When this header is set to true and specified together with the Range header, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size. - * @param 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. - */ - public Mono downloadWithRestResponseAsync(String shareName, String filePath, Integer timeout, String range, Boolean rangeGetContentMD5, Context context) { - return service.download(this.client.url(), shareName, filePath, timeout, this.client.version(), range, rangeGetContentMD5, context); - } - - /** - * Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not return the content of the file. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @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. - */ - public Mono getPropertiesWithRestResponseAsync(String shareName, String filePath, Context context) { - final String sharesnapshot = null; - final Integer timeout = null; - return service.getProperties(this.client.url(), shareName, filePath, sharesnapshot, timeout, this.client.version(), context); - } - - /** - * Returns all user-defined metadata, standard HTTP properties, and system properties for the file. It does not return the content of the file. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @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. - */ - public Mono getPropertiesWithRestResponseAsync(String shareName, String filePath, String sharesnapshot, Integer timeout, Context context) { - return service.getProperties(this.client.url(), shareName, filePath, sharesnapshot, timeout, this.client.version(), context); - } - - /** - * removes the file from the storage account. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @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. - */ - public Mono deleteWithRestResponseAsync(String shareName, String filePath, Context context) { - final Integer timeout = null; - return service.delete(this.client.url(), shareName, filePath, timeout, this.client.version(), context); - } - - /** - * removes the file from the storage account. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @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. - */ - public Mono deleteWithRestResponseAsync(String shareName, String filePath, Integer timeout, Context context) { - return service.delete(this.client.url(), shareName, filePath, timeout, this.client.version(), context); - } - - /** - * Sets HTTP headers on the file. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @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. - */ - public Mono setHTTPHeadersWithRestResponseAsync(String shareName, String filePath, Context context) { - final Integer timeout = null; - final Long fileContentLength = null; - final String comp = "properties"; - final String fileContentType = null; - final String fileContentEncoding = null; - final String fileContentLanguage = null; - final String fileCacheControl = null; - final String fileContentDisposition = null; - String fileContentMD5Converted = null; - return service.setHTTPHeaders(this.client.url(), shareName, filePath, timeout, this.client.version(), fileContentLength, comp, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); - } - - /** - * Sets HTTP headers on the file. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param fileContentLength Resizes a file to the specified size. If the specified byte value is less than the current size of the file, then all ranges above the specified byte value are cleared. - * @param fileHTTPHeaders Additional parameters for the operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - public Mono setHTTPHeadersWithRestResponseAsync(String shareName, String filePath, Integer timeout, Long fileContentLength, FileHTTPHeaders fileHTTPHeaders, Context context) { - final String comp = "properties"; - String fileContentType = null; - if (fileHTTPHeaders != null) { - fileContentType = fileHTTPHeaders.fileContentType(); - } - String fileContentEncoding = null; - if (fileHTTPHeaders != null) { - fileContentEncoding = fileHTTPHeaders.fileContentEncoding(); - } - String fileContentLanguage = null; - if (fileHTTPHeaders != null) { - fileContentLanguage = fileHTTPHeaders.fileContentLanguage(); - } - String fileCacheControl = null; - if (fileHTTPHeaders != null) { - fileCacheControl = fileHTTPHeaders.fileCacheControl(); - } - byte[] fileContentMD5 = null; - if (fileHTTPHeaders != null) { - fileContentMD5 = fileHTTPHeaders.fileContentMD5(); - } - String fileContentDisposition = null; - if (fileHTTPHeaders != null) { - fileContentDisposition = fileHTTPHeaders.fileContentDisposition(); - } - String fileContentMD5Converted = Base64Util.encodeToString(fileContentMD5); - return service.setHTTPHeaders(this.client.url(), shareName, filePath, timeout, this.client.version(), fileContentLength, comp, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5Converted, fileContentDisposition, context); - } - - /** - * Updates user-defined metadata for the specified file. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @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. - */ - public Mono setMetadataWithRestResponseAsync(String shareName, String filePath, Context context) { - final Integer timeout = null; - final Map metadata = null; - final String comp = "metadata"; - return service.setMetadata(this.client.url(), shareName, filePath, timeout, metadata, this.client.version(), comp, context); - } - - /** - * Updates user-defined metadata for the specified file. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param metadata A name-value pair to associate with a file storage object. - * @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. - */ - public Mono setMetadataWithRestResponseAsync(String shareName, String filePath, Integer timeout, Map metadata, Context context) { - final String comp = "metadata"; - return service.setMetadata(this.client.url(), shareName, filePath, timeout, metadata, this.client.version(), comp, context); - } - - /** - * Upload a range of bytes to a file. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. For an update operation, the range can be up to 4 MB in size. For a clear operation, the range can be up to the value of the file's full size. The File service accepts only a single byte range for the Range and 'x-ms-range' headers, and the byte range must be specified in the following format: bytes=startByte-endByte. - * @param fileRangeWrite Specify one of the following options: - Update: Writes the bytes specified by the request body into the specified range. The Range and Content-Length headers must match to perform the update. - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and set the Range header to a value that indicates the range to clear, up to maximum file size. Possible values include: 'update', 'clear'. - * @param contentLength Specifies the number of bytes being transmitted in the request body. When the x-ms-write header is set to clear, the value of this header must be set to zero. - * @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. - */ - public Mono uploadRangeWithRestResponseAsync(String shareName, String filePath, String range, FileRangeWriteType fileRangeWrite, long contentLength, Context context) { - final Flux optionalbody = null; - final Integer timeout = null; - final String comp = "range"; - String contentMD5Converted = null; - return service.uploadRange(this.client.url(), shareName, filePath, optionalbody, timeout, range, fileRangeWrite, contentLength, contentMD5Converted, this.client.version(), comp, context); - } - - /** - * Upload a range of bytes to a file. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @param range Specifies the range of bytes to be written. Both the start and end of the range must be specified. For an update operation, the range can be up to 4 MB in size. For a clear operation, the range can be up to the value of the file's full size. The File service accepts only a single byte range for the Range and 'x-ms-range' headers, and the byte range must be specified in the following format: bytes=startByte-endByte. - * @param fileRangeWrite Specify one of the following options: - Update: Writes the bytes specified by the request body into the specified range. The Range and Content-Length headers must match to perform the update. - Clear: Clears the specified range and releases the space used in storage for that range. To clear a range, set the Content-Length header to zero, and set the Range header to a value that indicates the range to clear, up to maximum file size. Possible values include: 'update', 'clear'. - * @param contentLength Specifies the number of bytes being transmitted in the request body. When the x-ms-write header is set to clear, the value of this header must be set to zero. - * @param optionalbody Initial data. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param contentMD5 An MD5 hash of the content. This hash is used to verify the integrity of the data during transport. When the Content-MD5 header is specified, the File service compares the hash of the content that has arrived with the header value that was sent. If the two hashes do not match, the operation will fail with error code 400 (Bad Request). - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - public Mono uploadRangeWithRestResponseAsync(String shareName, String filePath, String range, FileRangeWriteType fileRangeWrite, long contentLength, Flux optionalbody, Integer timeout, byte[] contentMD5, Context context) { - final String comp = "range"; - String contentMD5Converted = Base64Util.encodeToString(contentMD5); - return service.uploadRange(this.client.url(), shareName, filePath, optionalbody, timeout, range, fileRangeWrite, contentLength, contentMD5Converted, this.client.version(), comp, context); - } - - /** - * Returns the list of valid ranges for a file. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @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. - */ - public Mono getRangeListWithRestResponseAsync(String shareName, String filePath, Context context) { - final String sharesnapshot = null; - final Integer timeout = null; - final String range = null; - final String comp = "rangelist"; - return service.getRangeList(this.client.url(), shareName, filePath, sharesnapshot, timeout, this.client.version(), range, comp, context); - } - - /** - * Returns the list of valid ranges for a file. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param range Specifies the range of bytes over which to list ranges, inclusively. - * @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. - */ - public Mono getRangeListWithRestResponseAsync(String shareName, String filePath, String sharesnapshot, Integer timeout, String range, Context context) { - final String comp = "rangelist"; - return service.getRangeList(this.client.url(), shareName, filePath, sharesnapshot, timeout, this.client.version(), range, comp, context); - } - - /** - * Copies a blob or file to a destination file within the storage account. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @param copySource Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another file within the same storage account, you may use Shared Key to authenticate the source file. If you are copying a file from another storage account, or if you are copying a blob from the same storage account or another storage account, then you must authenticate the source file or blob using a shared access signature. If the source is a public blob, no authentication is required to perform the copy operation. A file in a share snapshot can also be specified as a copy source. - * @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. - */ - public Mono startCopyWithRestResponseAsync(String shareName, String filePath, String copySource, Context context) { - final Integer timeout = null; - final Map metadata = null; - return service.startCopy(this.client.url(), shareName, filePath, timeout, this.client.version(), metadata, copySource, context); - } - - /** - * Copies a blob or file to a destination file within the storage account. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @param copySource Specifies the URL of the source file or blob, up to 2 KB in length. To copy a file to another file within the same storage account, you may use Shared Key to authenticate the source file. If you are copying a file from another storage account, or if you are copying a blob from the same storage account or another storage account, then you must authenticate the source file or blob using a shared access signature. If the source is a public blob, no authentication is required to perform the copy operation. A file in a share snapshot can also be specified as a copy source. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param metadata A name-value pair to associate with a file storage object. - * @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. - */ - public Mono startCopyWithRestResponseAsync(String shareName, String filePath, String copySource, Integer timeout, Map metadata, Context context) { - return service.startCopy(this.client.url(), shareName, filePath, timeout, this.client.version(), metadata, copySource, context); - } - - /** - * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy File operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - public Mono abortCopyWithRestResponseAsync(String shareName, String filePath, String copyId, Context context) { - final Integer timeout = null; - final String copyActionAbortConstant = "abort"; - final String comp = "copy"; - return service.abortCopy(this.client.url(), shareName, filePath, copyId, timeout, copyActionAbortConstant, this.client.version(), comp, context); - } - - /** - * Aborts a pending Copy File operation, and leaves a destination file with zero length and full metadata. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @param copyId The copy identifier provided in the x-ms-copy-id header of the original Copy File operation. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @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. - */ - public Mono abortCopyWithRestResponseAsync(String shareName, String filePath, String copyId, Integer timeout, Context context) { - final String copyActionAbortConstant = "abort"; - final String comp = "copy"; - return service.abortCopy(this.client.url(), shareName, filePath, copyId, timeout, copyActionAbortConstant, this.client.version(), comp, context); - } - - /** - * Lists handles for file. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @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. - */ - public Mono listHandlesWithRestResponseAsync(String shareName, String filePath, Context context) { - final String marker = null; - final Integer maxresults = null; - final Integer timeout = null; - final String sharesnapshot = null; - final String comp = "listhandles"; - return service.listHandles(this.client.url(), shareName, filePath, marker, maxresults, timeout, sharesnapshot, this.client.version(), comp, context); - } - - /** - * Lists handles for file. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @param marker A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque to the client. - * @param maxresults Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000 items. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - * @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. - */ - public Mono listHandlesWithRestResponseAsync(String shareName, String filePath, String marker, Integer maxresults, Integer timeout, String sharesnapshot, Context context) { - final String comp = "listhandles"; - return service.listHandles(this.client.url(), shareName, filePath, marker, maxresults, timeout, sharesnapshot, this.client.version(), comp, context); - } - - /** - * Closes all handles open for given file. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterix (‘*’) is a wildcard that specifies all handles. - * @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. - */ - public Mono forceCloseHandlesWithRestResponseAsync(String shareName, String filePath, String handleId, Context context) { - final Integer timeout = null; - final String marker = null; - final String sharesnapshot = null; - final String comp = "forceclosehandles"; - return service.forceCloseHandles(this.client.url(), shareName, filePath, timeout, marker, sharesnapshot, handleId, this.client.version(), comp, context); - } - - /** - * Closes all handles open for given file. - * - * @param shareName Name of the share. - * @param filePath Path to the file. - * @param handleId Specifies handle ID opened on the file or directory to be closed. Asterix (‘*’) is a wildcard that specifies all handles. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param marker A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque to the client. - * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - * @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. - */ - public Mono forceCloseHandlesWithRestResponseAsync(String shareName, String filePath, String handleId, Integer timeout, String marker, String sharesnapshot, Context context) { - final String comp = "forceclosehandles"; - return service.forceCloseHandles(this.client.url(), shareName, filePath, timeout, marker, sharesnapshot, handleId, this.client.version(), comp, context); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/implementation/ListSharesIncludeTypeWrapper.java b/storage/client/src/main/java/com/azure/storage/file/implementation/ListSharesIncludeTypeWrapper.java deleted file mode 100644 index 280a657b38196..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/implementation/ListSharesIncludeTypeWrapper.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.implementation; - -import com.azure.storage.file.models.ListSharesIncludeType; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.List; - -/** - * A wrapper around List<ListSharesIncludeType> which provides top-level metadata for serialization. - */ -@JacksonXmlRootElement(localName = "ListSharesIncludeType") -public final class ListSharesIncludeTypeWrapper { - @JacksonXmlProperty(localName = "ListSharesIncludeType") - private final List listSharesIncludeType; - - /** - * Creates an instance of ListSharesIncludeTypeWrapper. - * - * @param listSharesIncludeType the list. - */ - @JsonCreator - public ListSharesIncludeTypeWrapper(@JsonProperty("ListSharesIncludeType") List listSharesIncludeType) { - this.listSharesIncludeType = listSharesIncludeType; - } - - /** - * Get the List<ListSharesIncludeType> contained in this wrapper. - * - * @return the List<ListSharesIncludeType>. - */ - public List items() { - return listSharesIncludeType; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/implementation/ServicesImpl.java b/storage/client/src/main/java/com/azure/storage/file/implementation/ServicesImpl.java deleted file mode 100644 index eeada84100f10..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/implementation/ServicesImpl.java +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.implementation; - -import com.azure.core.implementation.CollectionFormat; -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.Put; -import com.azure.core.implementation.annotation.QueryParam; -import com.azure.core.implementation.annotation.ServiceInterface; -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.file.models.FileServiceProperties; -import com.azure.storage.file.models.ListSharesIncludeType; -import com.azure.storage.file.models.ServicesGetPropertiesResponse; -import com.azure.storage.file.models.ServicesListSharesSegmentResponse; -import com.azure.storage.file.models.ServicesSetPropertiesResponse; -import com.azure.storage.file.models.StorageErrorException; -import reactor.core.publisher.Mono; - - -import java.util.List; - -/** - * An instance of this class provides access to all the operations defined in - * Services. - */ -public final class ServicesImpl { - /** - * The proxy service used to perform REST calls. - */ - private ServicesService service; - - /** - * The service client containing this operation class. - */ - private AzureFileStorageImpl client; - - /** - * Initializes an instance of ServicesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - public ServicesImpl(AzureFileStorageImpl client) { - this.service = RestProxy.create(ServicesService.class, client.httpPipeline()); - this.client = client; - } - - /** - * The interface defining all the services for Services to be used by the - * proxy service to perform REST calls. - */ - @Host("{url}") - @ServiceInterface(name = "Storage File Services") - private interface ServicesService { - @Put("") - @ExpectedResponses({202}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setProperties(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") FileServiceProperties fileServiceProperties, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); - - @Get("") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getProperties(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); - - @Get("") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono listSharesSegment(@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, @QueryParam("comp") String comp, Context context); - } - - /** - * Sets properties for a storage account's File service endpoint, including properties for Storage Analytics metrics and CORS (Cross-Origin Resource Sharing) rules. - * - * @param fileServiceProperties The FileService 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. - */ - public Mono setPropertiesWithRestResponseAsync(FileServiceProperties fileServiceProperties, Context context) { - final Integer timeout = null; - final String restype = "service"; - final String comp = "properties"; - return service.setProperties(this.client.url(), fileServiceProperties, timeout, this.client.version(), restype, comp, context); - } - - /** - * Sets properties for a storage account's File service endpoint, including properties for Storage Analytics metrics and CORS (Cross-Origin Resource Sharing) rules. - * - * @param fileServiceProperties The FileService properties. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @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. - */ - public Mono setPropertiesWithRestResponseAsync(FileServiceProperties fileServiceProperties, Integer timeout, Context context) { - final String restype = "service"; - final String comp = "properties"; - return service.setProperties(this.client.url(), fileServiceProperties, timeout, this.client.version(), restype, comp, context); - } - - /** - * Gets the properties of a storage account's File service, including properties for Storage Analytics metrics and CORS (Cross-Origin Resource Sharing) rules. - * - * @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. - */ - public Mono getPropertiesWithRestResponseAsync(Context context) { - final Integer timeout = null; - final String restype = "service"; - final String comp = "properties"; - return service.getProperties(this.client.url(), timeout, this.client.version(), restype, comp, context); - } - - /** - * Gets the properties of a storage account's File service, including properties for Storage Analytics metrics and CORS (Cross-Origin Resource Sharing) rules. - * - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @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. - */ - public Mono getPropertiesWithRestResponseAsync(Integer timeout, Context context) { - final String restype = "service"; - final String comp = "properties"; - return service.getProperties(this.client.url(), timeout, this.client.version(), restype, comp, context); - } - - /** - * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * - * @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. - */ - public Mono listSharesSegmentWithRestResponseAsync(Context context) { - final String prefix = null; - final String marker = null; - final Integer maxresults = null; - final Integer timeout = null; - final String comp = "list"; - String includeConverted = null; - return service.listSharesSegment(this.client.url(), prefix, marker, maxresults, includeConverted, timeout, this.client.version(), comp, context); - } - - /** - * The List Shares Segment operation returns a list of the shares and share snapshots under the specified account. - * - * @param prefix Filters the results to return only entries whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list to be returned with the next list operation. The operation returns a marker value within the response body if the list returned was not complete. The marker value may then be used in a subsequent call to request the next set of list items. The marker value is opaque to the client. - * @param maxresults Specifies the maximum number of entries to return. If the request does not specify maxresults, or specifies a value greater than 5,000, the server will return up to 5,000 items. - * @param include Include this parameter to specify one or more datasets to include in the response. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @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. - */ - public Mono listSharesSegmentWithRestResponseAsync(String prefix, String marker, Integer maxresults, List include, Integer timeout, Context context) { - final String comp = "list"; - String includeConverted = JacksonAdapter.createDefaultSerializerAdapter().serializeList(include, CollectionFormat.CSV); - return service.listSharesSegment(this.client.url(), prefix, marker, maxresults, includeConverted, timeout, this.client.version(), comp, context); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/implementation/SharesImpl.java b/storage/client/src/main/java/com/azure/storage/file/implementation/SharesImpl.java deleted file mode 100644 index 53a76f325fa68..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/implementation/SharesImpl.java +++ /dev/null @@ -1,398 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.implementation; - -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.ServiceInterface; -import com.azure.core.implementation.annotation.UnexpectedResponseExceptionType; -import com.azure.core.util.Context; -import com.azure.storage.file.models.DeleteSnapshotsOptionType; -import com.azure.storage.file.models.SharesCreateResponse; -import com.azure.storage.file.models.SharesCreateSnapshotResponse; -import com.azure.storage.file.models.SharesDeleteResponse; -import com.azure.storage.file.models.SharesGetAccessPolicyResponse; -import com.azure.storage.file.models.SharesGetPropertiesResponse; -import com.azure.storage.file.models.SharesGetStatisticsResponse; -import com.azure.storage.file.models.SharesSetAccessPolicyResponse; -import com.azure.storage.file.models.SharesSetMetadataResponse; -import com.azure.storage.file.models.SharesSetQuotaResponse; -import com.azure.storage.file.models.SignedIdentifier; -import com.azure.storage.file.models.StorageErrorException; -import java.util.List; -import reactor.core.publisher.Mono; -import java.util.Map; - -/** - * An instance of this class provides access to all the operations defined in - * Shares. - */ -@ServiceInterface(name = "Share") -public final class SharesImpl { - /** - * The proxy service used to perform REST calls. - */ - private SharesService service; - - /** - * The service client containing this operation class. - */ - private AzureFileStorageImpl client; - - /** - * Initializes an instance of SharesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - public SharesImpl(AzureFileStorageImpl client) { - this.service = RestProxy.create(SharesService.class, client.httpPipeline()); - this.client = client; - } - - /** - * The interface defining all the services for Shares to be used by the - * proxy service to perform REST calls. - */ - @Host("{url}") - @ServiceInterface(name = "Storage File Shares") - private interface SharesService { - @Put("{shareName}") - @ExpectedResponses({201}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono create(@HostParam("url") String url, @PathParam("shareName") String shareName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-share-quota") Integer quota, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); - - @Get("{shareName}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getProperties(@HostParam("url") String url, @PathParam ("shareName") String shareName, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, Context context); - - @Delete("{shareName}") - @ExpectedResponses({202}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono delete(@HostParam("url") String url, @PathParam ("shareName") String shareName, @QueryParam("sharesnapshot") String sharesnapshot, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-delete-snapshots") DeleteSnapshotsOptionType deleteSnapshots, @QueryParam("restype") String restype, Context context); - - @Put("{shareName}") - @ExpectedResponses({201}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono createSnapshot(@HostParam("url") String url, @PathParam ("shareName") String shareName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); - - @Put("{shareName}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setQuota(@HostParam("url") String url, @PathParam ("shareName") String shareName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-share-quota") Integer quota, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); - - @Put("{shareName}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setMetadata(@HostParam("url") String url, @PathParam ("shareName") String shareName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-meta-") Map metadata, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); - - @Get("{shareName}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getAccessPolicy(@HostParam("url") String url, @PathParam ("shareName") String shareName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); - - @Put("{shareName}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setAccessPolicy(@HostParam("url") String url, @PathParam ("shareName") String shareName, @BodyParam("application/xml; charset=utf-8") SignedIdentifiersWrapper shareAcl, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); - - @Get("{shareName}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getStatistics(@HostParam("url") String url, @PathParam ("shareName") String shareName, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @QueryParam("restype") String restype, @QueryParam("comp") String comp, Context context); - } - - /** - * Creates a new share under the specified account. If the share with the same name already exists, the operation fails. - * - * @param shareName The name of the share to create. - * @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. - */ - public Mono createWithRestResponseAsync(String shareName, Context context) { - final Integer timeout = null; - final Map metadata = null; - final Integer quota = null; - final String restype = "share"; - return service.create(this.client.url(), shareName, timeout, metadata, quota, this.client.version(), restype, context); - } - - /** - * Creates a new share under the specified account. If the share with the same name already exists, the operation fails. - * - * @param shareName The name of the share to create. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param metadata A name-value pair to associate with a file storage object. - * @param quota Specifies the maximum size of the share, in gigabytes. - * @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. - */ - public Mono createWithRestResponseAsync(String shareName, Integer timeout, Map metadata, Integer quota, Context context) { - final String restype = "share"; - return service.create(this.client.url(), shareName, timeout, metadata, quota, this.client.version(), restype, context); - } - - /** - * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data returned does not include the share's list of files. - * - * @param shareName The name of the share that is having its properties retrieved. - * @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. - */ - public Mono getPropertiesWithRestResponseAsync(String shareName, Context context) { - final String sharesnapshot = null; - final Integer timeout = null; - final String restype = "share"; - return service.getProperties(this.client.url(), shareName, sharesnapshot, timeout, this.client.version(), restype, context); - } - - /** - * Returns all user-defined metadata and system properties for the specified share or share snapshot. The data returned does not include the share's list of files. - * - * @param shareName The name of the share that is having its properties retrieved. - * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @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. - */ - public Mono getPropertiesWithRestResponseAsync(String shareName, String sharesnapshot, Integer timeout, Context context) { - final String restype = "share"; - return service.getProperties(this.client.url(), shareName, sharesnapshot, timeout, this.client.version(), restype, context); - } - - /** - * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files contained within it are later deleted during garbage collection. - * - * @param shareName The name of the share to delete. - * @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. - */ - public Mono deleteWithRestResponseAsync(String shareName, Context context) { - final String sharesnapshot = null; - final Integer timeout = null; - final DeleteSnapshotsOptionType deleteSnapshots = null; - final String restype = "share"; - return service.delete(this.client.url(), shareName, sharesnapshot, timeout, this.client.version(), deleteSnapshots, restype, context); - } - - /** - * Operation marks the specified share or share snapshot for deletion. The share or share snapshot and any files contained within it are later deleted during garbage collection. - * - * @param shareName The name of the share to delete. - * @param sharesnapshot The snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param deleteSnapshots Specifies the option include to delete the base share and all of its snapshots. Possible values include: 'include'. - * @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. - */ - public Mono deleteWithRestResponseAsync(String shareName, String sharesnapshot, Integer timeout, DeleteSnapshotsOptionType deleteSnapshots, Context context) { - final String restype = "share"; - return service.delete(this.client.url(), shareName, sharesnapshot, timeout, this.client.version(), deleteSnapshots, restype, context); - } - - /** - * Creates a read-only snapshot of a share. - * - * @param shareName The name of the share that is having a snapshot created. - * @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. - */ - public Mono createSnapshotWithRestResponseAsync(String shareName, Context context) { - final Integer timeout = null; - final Map metadata = null; - final String restype = "share"; - final String comp = "snapshot"; - return service.createSnapshot(this.client.url(), shareName, timeout, metadata, this.client.version(), restype, comp, context); - } - - /** - * Creates a read-only snapshot of a share. - * - * @param shareName The name of the share that is having a snapshot created. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param metadata A name-value pair to associate with a file storage object. - * @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. - */ - public Mono createSnapshotWithRestResponseAsync(String shareName, Integer timeout, Map metadata, Context context) { - final String restype = "share"; - final String comp = "snapshot"; - return service.createSnapshot(this.client.url(), shareName, timeout, metadata, this.client.version(), restype, comp, context); - } - - /** - * Sets quota for the specified share. - * - * @param shareName The name of the share that is having its quota set. - * @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. - */ - public Mono setQuotaWithRestResponseAsync(String shareName, Context context) { - final Integer timeout = null; - final Integer quota = null; - final String restype = "share"; - final String comp = "properties"; - return service.setQuota(this.client.url(), shareName, timeout, this.client.version(), quota, restype, comp, context); - } - - /** - * Sets quota for the specified share. - * - * @param shareName The name of the share that is having its quota set. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param quota Specifies the maximum size of the share, in gigabytes. - * @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. - */ - public Mono setQuotaWithRestResponseAsync(String shareName, Integer timeout, Integer quota, Context context) { - final String restype = "share"; - final String comp = "properties"; - return service.setQuota(this.client.url(), shareName, timeout, this.client.version(), quota, restype, comp, context); - } - - /** - * Sets one or more user-defined name-value pairs for the specified share. - * - * @param shareName The name of the share having its metadata set. - * @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. - */ - public Mono setMetadataWithRestResponseAsync(String shareName, Context context) { - final Integer timeout = null; - final Map metadata = null; - final String restype = "share"; - final String comp = "metadata"; - return service.setMetadata(this.client.url(), shareName, timeout, metadata, this.client.version(), restype, comp, context); - } - - /** - * Sets one or more user-defined name-value pairs for the specified share. - * - * @param shareName The name of the share having its metadata set. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @param metadata A name-value pair to associate with a file storage object. - * @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. - */ - public Mono setMetadataWithRestResponseAsync(String shareName, Integer timeout, Map metadata, Context context) { - final String restype = "share"; - final String comp = "metadata"; - return service.setMetadata(this.client.url(), shareName, timeout, metadata, this.client.version(), restype, comp, context); - } - - /** - * Returns information about stored access policies specified on the share. - * - * @param shareName The name of the share having its access policy retrieved. - * @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. - */ - public Mono getAccessPolicyWithRestResponseAsync(String shareName, Context context) { - final Integer timeout = null; - final String restype = "share"; - final String comp = "acl"; - return service.getAccessPolicy(this.client.url(), shareName, timeout, this.client.version(), restype, comp, context); - } - - /** - * Returns information about stored access policies specified on the share. - * - * @param shareName The name of the share having its access policy retrieved. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @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. - */ - public Mono getAccessPolicyWithRestResponseAsync(String shareName, Integer timeout, Context context) { - final String restype = "share"; - final String comp = "acl"; - return service.getAccessPolicy(this.client.url(), shareName, timeout, this.client.version(), restype, comp, context); - } - - /** - * Sets a stored access policy for use with shared access signatures. - * - * @param shareName The name of the share having its access policy set. - * @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. - */ - public Mono setAccessPolicyWithRestResponseAsync(String shareName, Context context) { - final Integer timeout = null; - final String restype = "share"; - final String comp = "acl"; - SignedIdentifiersWrapper shareAclConverted = new SignedIdentifiersWrapper(null); - return service.setAccessPolicy(this.client.url(), shareName, shareAclConverted, timeout, this.client.version(), restype, comp, context); - } - - /** - * Sets a stored access policy for use with shared access signatures. - * - * @param shareName The name of the share having its access policy set. - * @param shareAcl The ACL for the share. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @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. - */ - public Mono setAccessPolicyWithRestResponseAsync(String shareName, List shareAcl, Integer timeout, Context context) { - final String restype = "share"; - final String comp = "acl"; - SignedIdentifiersWrapper shareAclConverted = new SignedIdentifiersWrapper(shareAcl); - return service.setAccessPolicy(this.client.url(), shareName, shareAclConverted, timeout, this.client.version(), restype, comp, context); - } - - /** - * Retrieves statistics related to the share. - * - * @param shareName The name of the share having its statistics retrieved. - * @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. - */ - public Mono getStatisticsWithRestResponseAsync(String shareName, Context context) { - final Integer timeout = null; - final String restype = "share"; - final String comp = "stats"; - return service.getStatistics(this.client.url(), shareName, timeout, this.client.version(), restype, comp, context); - } - - /** - * Retrieves statistics related to the share. - * - * @param shareName The name of the share having its statistics retrieved. - * @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/Setting-Timeouts-for-File-Service-Operations?redirectedfrom=MSDN">Setting Timeouts for File Service Operations.</a>. - * @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. - */ - public Mono getStatisticsWithRestResponseAsync(String shareName, Integer timeout, Context context) { - final String restype = "share"; - final String comp = "stats"; - return service.getStatistics(this.client.url(), shareName, timeout, this.client.version(), restype, comp, context); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/implementation/SignedIdentifiersWrapper.java b/storage/client/src/main/java/com/azure/storage/file/implementation/SignedIdentifiersWrapper.java deleted file mode 100644 index da1e30459bfcb..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/implementation/SignedIdentifiersWrapper.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.implementation; - -import com.azure.storage.file.models.SignedIdentifier; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.List; - -/** - * A wrapper around List<SignedIdentifier> which provides top-level metadata for serialization. - */ -@JacksonXmlRootElement(localName = "SignedIdentifiers") -public final class SignedIdentifiersWrapper { - @JacksonXmlProperty(localName = "SignedIdentifier") - private final List signedIdentifiers; - - /** - * Creates an instance of SignedIdentifiersWrapper. - * - * @param signedIdentifiers the list. - */ - @JsonCreator - public SignedIdentifiersWrapper(@JsonProperty("SignedIdentifier") List signedIdentifiers) { - this.signedIdentifiers = signedIdentifiers; - } - - /** - * Get the List<SignedIdentifier> contained in this wrapper. - * - * @return the List<SignedIdentifier>. - */ - public List items() { - return signedIdentifiers; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/implementation/package-info.java b/storage/client/src/main/java/com/azure/storage/file/implementation/package-info.java deleted file mode 100644 index c7e9e946b39e4..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/implementation/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -/** - * This package contains the implementations and inner classes for - * AzureFileStorage. - */ -package com.azure.storage.file.implementation; diff --git a/storage/client/src/main/java/com/azure/storage/file/models/AccessPolicy.java b/storage/client/src/main/java/com/azure/storage/file/models/AccessPolicy.java deleted file mode 100644 index 94ccd39fbec5f..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/AccessPolicy.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * An Access policy. - */ -@JacksonXmlRootElement(localName = "AccessPolicy") -public final class AccessPolicy { - /* - * The date-time the policy is active. - */ - @JsonProperty(value = "Start") - private OffsetDateTime start; - - /* - * The date-time the policy expires. - */ - @JsonProperty(value = "Expiry") - private OffsetDateTime expiry; - - /* - * The permissions for the ACL policy. - */ - @JsonProperty(value = "Permission") - private String permission; - - /** - * Get the start property: The date-time the policy is active. - * - * @return the start value. - */ - public OffsetDateTime start() { - return this.start; - } - - /** - * Set the start property: The date-time the policy is active. - * - * @param start the start value to set. - * @return the AccessPolicy object itself. - */ - public AccessPolicy start(OffsetDateTime start) { - this.start = start; - return this; - } - - /** - * Get the expiry property: The date-time the policy expires. - * - * @return the expiry value. - */ - public OffsetDateTime expiry() { - return this.expiry; - } - - /** - * Set the expiry property: The date-time the policy expires. - * - * @param expiry the expiry value to set. - * @return the AccessPolicy object itself. - */ - public AccessPolicy expiry(OffsetDateTime expiry) { - this.expiry = expiry; - return this; - } - - /** - * Get the permission property: The permissions for the ACL policy. - * - * @return the permission value. - */ - public String permission() { - return this.permission; - } - - /** - * Set the permission property: The permissions for the ACL policy. - * - * @param permission the permission value to set. - * @return the AccessPolicy object itself. - */ - public AccessPolicy permission(String permission) { - this.permission = permission; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/CopyStatusType.java b/storage/client/src/main/java/com/azure/storage/file/models/CopyStatusType.java deleted file mode 100644 index 1d14aa7b9a316..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/CopyStatusType.java +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for CopyStatusType. - */ -public enum CopyStatusType { - /** - * Enum value pending. - */ - PENDING("pending"), - - /** - * Enum value success. - */ - SUCCESS("success"), - - /** - * Enum value aborted. - */ - ABORTED("aborted"), - - /** - * Enum value failed. - */ - FAILED("failed"); - - /** - * The actual serialized value for a CopyStatusType instance. - */ - private final String value; - - CopyStatusType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a CopyStatusType instance. - * - * @param value the serialized value to parse. - * @return the parsed CopyStatusType object, or null if unable to parse. - */ - @JsonCreator - public static CopyStatusType fromString(String value) { - CopyStatusType[] items = CopyStatusType.values(); - for (CopyStatusType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/CorsRule.java b/storage/client/src/main/java/com/azure/storage/file/models/CorsRule.java deleted file mode 100644 index 998d7c00bbf93..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/CorsRule.java +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * CORS is an HTTP feature that enables a web application running under one - * domain to access resources in another domain. Web browsers implement a - * security restriction known as same-origin policy that prevents a web page - * from calling APIs in a different domain; CORS provides a secure way to allow - * one domain (the origin domain) to call APIs in another domain. - */ -@JacksonXmlRootElement(localName = "CorsRule") -public final class CorsRule { - /* - * The origin domains that are permitted to make a request against the - * storage service via CORS. The origin domain is the domain from which the - * request originates. Note that the origin must be an exact case-sensitive - * match with the origin that the user age sends to the service. You can - * also use the wildcard character '*' to allow all origin domains to make - * requests via CORS. - */ - @JsonProperty(value = "AllowedOrigins", required = true) - private String allowedOrigins; - - /* - * The methods (HTTP request verbs) that the origin domain may use for a - * CORS request. (comma separated) - */ - @JsonProperty(value = "AllowedMethods", required = true) - private String allowedMethods; - - /* - * The request headers that the origin domain may specify on the CORS - * request. - */ - @JsonProperty(value = "AllowedHeaders", required = true) - private String allowedHeaders; - - /* - * The response headers that may be sent in the response to the CORS - * request and exposed by the browser to the request issuer. - */ - @JsonProperty(value = "ExposedHeaders", required = true) - private String exposedHeaders; - - /* - * The maximum amount time that a browser should cache the preflight - * OPTIONS request. - */ - @JsonProperty(value = "MaxAgeInSeconds", required = true) - private int maxAgeInSeconds; - - /** - * Get the allowedOrigins property: The origin domains that are permitted - * to make a request against the storage service via CORS. The origin - * domain is the domain from which the request originates. Note that the - * origin must be an exact case-sensitive match with the origin that the - * user age sends to the service. You can also use the wildcard character - * '*' to allow all origin domains to make requests via CORS. - * - * @return the allowedOrigins value. - */ - public String allowedOrigins() { - return this.allowedOrigins; - } - - /** - * Set the allowedOrigins property: The origin domains that are permitted - * to make a request against the storage service via CORS. The origin - * domain is the domain from which the request originates. Note that the - * origin must be an exact case-sensitive match with the origin that the - * user age sends to the service. You can also use the wildcard character - * '*' to allow all origin domains to make requests via CORS. - * - * @param allowedOrigins the allowedOrigins value to set. - * @return the CorsRule object itself. - */ - public CorsRule allowedOrigins(String allowedOrigins) { - this.allowedOrigins = allowedOrigins; - return this; - } - - /** - * Get the allowedMethods property: The methods (HTTP request verbs) that - * the origin domain may use for a CORS request. (comma separated). - * - * @return the allowedMethods value. - */ - public String allowedMethods() { - return this.allowedMethods; - } - - /** - * Set the allowedMethods property: The methods (HTTP request verbs) that - * the origin domain may use for a CORS request. (comma separated). - * - * @param allowedMethods the allowedMethods value to set. - * @return the CorsRule object itself. - */ - public CorsRule allowedMethods(String allowedMethods) { - this.allowedMethods = allowedMethods; - return this; - } - - /** - * Get the allowedHeaders property: The request headers that the origin - * domain may specify on the CORS request. - * - * @return the allowedHeaders value. - */ - public String allowedHeaders() { - return this.allowedHeaders; - } - - /** - * Set the allowedHeaders property: The request headers that the origin - * domain may specify on the CORS request. - * - * @param allowedHeaders the allowedHeaders value to set. - * @return the CorsRule object itself. - */ - public CorsRule allowedHeaders(String allowedHeaders) { - this.allowedHeaders = allowedHeaders; - return this; - } - - /** - * Get the exposedHeaders property: The response headers that may be sent - * in the response to the CORS request and exposed by the browser to the - * request issuer. - * - * @return the exposedHeaders value. - */ - public String exposedHeaders() { - return this.exposedHeaders; - } - - /** - * Set the exposedHeaders property: The response headers that may be sent - * in the response to the CORS request and exposed by the browser to the - * request issuer. - * - * @param exposedHeaders the exposedHeaders value to set. - * @return the CorsRule object itself. - */ - public CorsRule exposedHeaders(String exposedHeaders) { - this.exposedHeaders = exposedHeaders; - return this; - } - - /** - * Get the maxAgeInSeconds property: The maximum amount time that a browser - * should cache the preflight OPTIONS request. - * - * @return the maxAgeInSeconds value. - */ - public int maxAgeInSeconds() { - return this.maxAgeInSeconds; - } - - /** - * Set the maxAgeInSeconds property: The maximum amount time that a browser - * should cache the preflight OPTIONS request. - * - * @param maxAgeInSeconds the maxAgeInSeconds value to set. - * @return the CorsRule object itself. - */ - public CorsRule maxAgeInSeconds(int maxAgeInSeconds) { - this.maxAgeInSeconds = maxAgeInSeconds; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DeleteSnapshotsOptionType.java b/storage/client/src/main/java/com/azure/storage/file/models/DeleteSnapshotsOptionType.java deleted file mode 100644 index 002eb887ac448..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DeleteSnapshotsOptionType.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for DeleteSnapshotsOptionType. - */ -public enum DeleteSnapshotsOptionType { - /** - * Enum value include. - */ - INCLUDE("include"); - - /** - * The actual serialized value for a DeleteSnapshotsOptionType instance. - */ - private final String value; - - DeleteSnapshotsOptionType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a DeleteSnapshotsOptionType instance. - * - * @param value the serialized value to parse. - * @return the parsed DeleteSnapshotsOptionType object, or null if unable to parse. - */ - @JsonCreator - public static DeleteSnapshotsOptionType fromString(String value) { - DeleteSnapshotsOptionType[] items = DeleteSnapshotsOptionType.values(); - for (DeleteSnapshotsOptionType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryCreateHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/DirectoryCreateHeaders.java deleted file mode 100644 index f4f14ebd7c7b4..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryCreateHeaders.java +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Create operation. - */ -@JacksonXmlRootElement(localName = "Directory-Create-Headers") -public final class DirectoryCreateHeaders { - /* - * The ETag contains a value which represents the version of the directory, - * in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the share was last modified. Any operation - * that modifies the directory or its properties updates the last modified - * time. Operations on files do not affect the last modified time of the - * directory. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The value of this header is set to true if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. - */ - @JsonProperty(value = "x-ms-request-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value which represents the - * version of the directory, in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value which represents the - * version of the directory, in quotes. - * - * @param eTag the eTag value to set. - * @return the DirectoryCreateHeaders object itself. - */ - public DirectoryCreateHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the directory or its - * properties updates the last modified time. Operations on files do not - * affect the last modified time of the directory. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the directory or its - * properties updates the last modified time. Operations on files do not - * affect the last modified time of the directory. - * - * @param lastModified the lastModified value to set. - * @return the DirectoryCreateHeaders object itself. - */ - public DirectoryCreateHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the DirectoryCreateHeaders object itself. - */ - public DirectoryCreateHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the DirectoryCreateHeaders object itself. - */ - public DirectoryCreateHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the DirectoryCreateHeaders object itself. - */ - public DirectoryCreateHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the DirectoryCreateHeaders object itself. - */ - public DirectoryCreateHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the DirectoryCreateHeaders object itself. - */ - public DirectoryCreateHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryDeleteHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/DirectoryDeleteHeaders.java deleted file mode 100644 index 7e98303ea6e71..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryDeleteHeaders.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Delete operation. - */ -@JacksonXmlRootElement(localName = "Directory-Delete-Headers") -public final class DirectoryDeleteHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the DirectoryDeleteHeaders object itself. - */ - public DirectoryDeleteHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the DirectoryDeleteHeaders object itself. - */ - public DirectoryDeleteHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the DirectoryDeleteHeaders object itself. - */ - public DirectoryDeleteHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the DirectoryDeleteHeaders object itself. - */ - public DirectoryDeleteHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryForceCloseHandlesHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/DirectoryForceCloseHandlesHeaders.java deleted file mode 100644 index 08722706147e4..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryForceCloseHandlesHeaders.java +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for ForceCloseHandles operation. - */ -@JacksonXmlRootElement(localName = "Directory-ForceCloseHandles-Headers") -public final class DirectoryForceCloseHandlesHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * A string describing next handle to be closed. It is returned when more - * handles need to be closed to complete the request. - */ - @JsonProperty(value = "x-ms-marker") - private String marker; - - /* - * Contains count of number of handles closed. - */ - @JsonProperty(value = "x-ms-number-of-handles-closed") - private Integer numberOfHandlesClosed; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the DirectoryForceCloseHandlesHeaders object itself. - */ - public DirectoryForceCloseHandlesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the DirectoryForceCloseHandlesHeaders object itself. - */ - public DirectoryForceCloseHandlesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the DirectoryForceCloseHandlesHeaders object itself. - */ - public DirectoryForceCloseHandlesHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the marker property: A string describing next handle to be closed. - * It is returned when more handles need to be closed to complete the - * request. - * - * @return the marker value. - */ - public String marker() { - return this.marker; - } - - /** - * Set the marker property: A string describing next handle to be closed. - * It is returned when more handles need to be closed to complete the - * request. - * - * @param marker the marker value to set. - * @return the DirectoryForceCloseHandlesHeaders object itself. - */ - public DirectoryForceCloseHandlesHeaders marker(String marker) { - this.marker = marker; - return this; - } - - /** - * Get the numberOfHandlesClosed property: Contains count of number of - * handles closed. - * - * @return the numberOfHandlesClosed value. - */ - public Integer numberOfHandlesClosed() { - return this.numberOfHandlesClosed; - } - - /** - * Set the numberOfHandlesClosed property: Contains count of number of - * handles closed. - * - * @param numberOfHandlesClosed the numberOfHandlesClosed value to set. - * @return the DirectoryForceCloseHandlesHeaders object itself. - */ - public DirectoryForceCloseHandlesHeaders numberOfHandlesClosed(Integer numberOfHandlesClosed) { - this.numberOfHandlesClosed = numberOfHandlesClosed; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the DirectoryForceCloseHandlesHeaders object itself. - */ - public DirectoryForceCloseHandlesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryGetPropertiesHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/DirectoryGetPropertiesHeaders.java deleted file mode 100644 index 5739160de25c7..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryGetPropertiesHeaders.java +++ /dev/null @@ -1,263 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.annotations.HeaderCollection; -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; -import java.util.Map; - -/** - * Defines headers for GetProperties operation. - */ -@JacksonXmlRootElement(localName = "Directory-GetProperties-Headers") -public final class DirectoryGetPropertiesHeaders { - /* - * The metadata property. - */ - @HeaderCollection("x-ms-meta-") - private Map metadata; - - /* - * The ETag contains a value that you can use to perform operations - * conditionally, in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the Directory was last modified. Operations on - * files within the directory do not affect the last modified time of the - * directory. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The value of this header is set to true if the directory metadata is - * completely encrypted using the specified algorithm. Otherwise, the value - * is set to false. - */ - @JsonProperty(value = "x-ms-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the metadata property: The metadata property. - * - * @return the metadata value. - */ - public Map metadata() { - return this.metadata; - } - - /** - * Set the metadata property: The metadata property. - * - * @param metadata the metadata value to set. - * @return the DirectoryGetPropertiesHeaders object itself. - */ - public DirectoryGetPropertiesHeaders metadata(Map metadata) { - this.metadata = metadata; - return this; - } - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @param eTag the eTag value to set. - * @return the DirectoryGetPropertiesHeaders object itself. - */ - public DirectoryGetPropertiesHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the Directory - * was last modified. Operations on files within the directory do not - * affect the last modified time of the directory. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the Directory - * was last modified. Operations on files within the directory do not - * affect the last modified time of the directory. - * - * @param lastModified the lastModified value to set. - * @return the DirectoryGetPropertiesHeaders object itself. - */ - public DirectoryGetPropertiesHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the DirectoryGetPropertiesHeaders object itself. - */ - public DirectoryGetPropertiesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the DirectoryGetPropertiesHeaders object itself. - */ - public DirectoryGetPropertiesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the DirectoryGetPropertiesHeaders object itself. - */ - public DirectoryGetPropertiesHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the directory metadata is completely encrypted using the - * specified algorithm. Otherwise, the value is set to false. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the directory metadata is completely encrypted using the - * specified algorithm. Otherwise, the value is set to false. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the DirectoryGetPropertiesHeaders object itself. - */ - public DirectoryGetPropertiesHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the DirectoryGetPropertiesHeaders object itself. - */ - public DirectoryGetPropertiesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryInfo.java b/storage/client/src/main/java/com/azure/storage/file/models/DirectoryInfo.java deleted file mode 100644 index 4248582e22d9b..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryInfo.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file.models; - -import java.time.OffsetDateTime; - -/** - * Contains information about a Directory in the storage File service. - */ -public final class DirectoryInfo { - private String eTag; - private OffsetDateTime lastModified; - - /** - * Creates an instance of information about a specific Directory. - * - * @param eTag Entity tag that corresponds to the directory. - * @param lastModified Last time the directory was modified. - */ - public DirectoryInfo(final String eTag, final OffsetDateTime lastModified) { - this.eTag = eTag; - this.lastModified = lastModified; - } - - /** - * @return The entity tag that corresponds to the directory. - */ - public String eTag() { - return eTag; - } - - /** - * @return The last time the share was modified. - */ - public OffsetDateTime lastModified() { - return lastModified; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryItem.java b/storage/client/src/main/java/com/azure/storage/file/models/DirectoryItem.java deleted file mode 100644 index 4f385aee443ec..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryItem.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * A listed directory item. - */ -@JacksonXmlRootElement(localName = "Directory") -public final class DirectoryItem { - /* - * The name property. - */ - @JsonProperty(value = "Name", required = true) - private String name; - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: The name property. - * - * @param name the name value to set. - * @return the DirectoryItem object itself. - */ - public DirectoryItem name(String name) { - this.name = name; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryListFilesAndDirectoriesSegmentHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/DirectoryListFilesAndDirectoriesSegmentHeaders.java deleted file mode 100644 index cbcd8b9d60100..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryListFilesAndDirectoriesSegmentHeaders.java +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for ListFilesAndDirectoriesSegment operation. - */ -@JacksonXmlRootElement(localName = "Directory-ListFilesAndDirectoriesSegment-Headers") -public final class DirectoryListFilesAndDirectoriesSegmentHeaders { - /* - * Specifies the format in which the results are returned. Currently this - * value is 'application/xml'. - */ - @JsonProperty(value = "Content-Type") - private String contentType; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the contentType property: Specifies the format in which the results - * are returned. Currently this value is 'application/xml'. - * - * @return the contentType value. - */ - public String contentType() { - return this.contentType; - } - - /** - * Set the contentType property: Specifies the format in which the results - * are returned. Currently this value is 'application/xml'. - * - * @param contentType the contentType value to set. - * @return the DirectoryListFilesAndDirectoriesSegmentHeaders object - * itself. - */ - public DirectoryListFilesAndDirectoriesSegmentHeaders contentType(String contentType) { - this.contentType = contentType; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the DirectoryListFilesAndDirectoriesSegmentHeaders object - * itself. - */ - public DirectoryListFilesAndDirectoriesSegmentHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the DirectoryListFilesAndDirectoriesSegmentHeaders object - * itself. - */ - public DirectoryListFilesAndDirectoriesSegmentHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the DirectoryListFilesAndDirectoriesSegmentHeaders object - * itself. - */ - public DirectoryListFilesAndDirectoriesSegmentHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the DirectoryListFilesAndDirectoriesSegmentHeaders object - * itself. - */ - public DirectoryListFilesAndDirectoriesSegmentHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryListHandlesHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/DirectoryListHandlesHeaders.java deleted file mode 100644 index c816949938439..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryListHandlesHeaders.java +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for ListHandles operation. - */ -@JacksonXmlRootElement(localName = "Directory-ListHandles-Headers") -public final class DirectoryListHandlesHeaders { - /* - * Specifies the format in which the results are returned. Currently this - * value is 'application/xml'. - */ - @JsonProperty(value = "Content-Type") - private String contentType; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the contentType property: Specifies the format in which the results - * are returned. Currently this value is 'application/xml'. - * - * @return the contentType value. - */ - public String contentType() { - return this.contentType; - } - - /** - * Set the contentType property: Specifies the format in which the results - * are returned. Currently this value is 'application/xml'. - * - * @param contentType the contentType value to set. - * @return the DirectoryListHandlesHeaders object itself. - */ - public DirectoryListHandlesHeaders contentType(String contentType) { - this.contentType = contentType; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the DirectoryListHandlesHeaders object itself. - */ - public DirectoryListHandlesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the DirectoryListHandlesHeaders object itself. - */ - public DirectoryListHandlesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the DirectoryListHandlesHeaders object itself. - */ - public DirectoryListHandlesHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the DirectoryListHandlesHeaders object itself. - */ - public DirectoryListHandlesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryProperties.java b/storage/client/src/main/java/com/azure/storage/file/models/DirectoryProperties.java deleted file mode 100644 index f39e8d8ac0162..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DirectoryProperties.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file.models; - -import java.time.OffsetDateTime; -import java.util.Map; - -/** - * Contains properties information about a Directory in the storage File service. - */ -public final class DirectoryProperties { - private Map metadata; - private String eTag; - private OffsetDateTime lastModified; - private boolean isServerEncrypted; - - /** - * Creates an instance of properties information about a specific Directory. - * - * @param metadata A set of name-value pairs that contain metadata for the directory. - * @param eTag Entity tag that corresponds to the directory. - * @param lastModified Last time the directory was modified. - * @param isServerEncrypted The value of this header is set to true if the directory metadata is completely encrypted using the specified algorithm. Otherwise, the value is set to false. - */ - public DirectoryProperties(final Map metadata, final String eTag, final OffsetDateTime lastModified, final boolean isServerEncrypted) { - this.metadata = metadata; - this.eTag = eTag; - this.lastModified = lastModified; - this.isServerEncrypted = isServerEncrypted; - } - - /** - * @return A set of name-value pairs that contain metadata for the directory. - */ - public Map metadata() { - return metadata; - } - - /** - * @return Entity tag that corresponds to the directory. - */ - public String eTag() { - return eTag; - } - - /** - * @return Entity tag that corresponds to the directory. - */ - public OffsetDateTime lastModified() { - return lastModified; - } - - /** - * @return The value of this header is true if the directory metadata is completely encrypted using the specified algorithm. Otherwise, the value is false. - */ - public boolean isServerEncrypted() { - return isServerEncrypted; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectorySetMetadataHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/DirectorySetMetadataHeaders.java deleted file mode 100644 index 603bde2f285aa..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DirectorySetMetadataHeaders.java +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for SetMetadata operation. - */ -@JacksonXmlRootElement(localName = "Directory-SetMetadata-Headers") -public final class DirectorySetMetadataHeaders { - /* - * The ETag contains a value which represents the version of the directory, - * in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The value of this header is set to true if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. - */ - @JsonProperty(value = "x-ms-request-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value which represents the - * version of the directory, in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value which represents the - * version of the directory, in quotes. - * - * @param eTag the eTag value to set. - * @return the DirectorySetMetadataHeaders object itself. - */ - public DirectorySetMetadataHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the DirectorySetMetadataHeaders object itself. - */ - public DirectorySetMetadataHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the DirectorySetMetadataHeaders object itself. - */ - public DirectorySetMetadataHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the DirectorySetMetadataHeaders object itself. - */ - public DirectorySetMetadataHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the DirectorySetMetadataHeaders object itself. - */ - public DirectorySetMetadataHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the DirectorySetMetadataHeaders object itself. - */ - public DirectorySetMetadataHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectorysCreateResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/DirectorysCreateResponse.java deleted file mode 100644 index a65683e6cfc87..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DirectorysCreateResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the create operation. - */ -public final class DirectorysCreateResponse extends ResponseBase { - /** - * Creates an instance of DirectorysCreateResponse. - * - * @param request the request which resulted in this DirectorysCreateResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public DirectorysCreateResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, DirectoryCreateHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectorysDeleteResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/DirectorysDeleteResponse.java deleted file mode 100644 index 239dcaba95e59..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DirectorysDeleteResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the delete operation. - */ -public final class DirectorysDeleteResponse extends ResponseBase { - /** - * Creates an instance of DirectorysDeleteResponse. - * - * @param request the request which resulted in this DirectorysDeleteResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public DirectorysDeleteResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, DirectoryDeleteHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectorysForceCloseHandlesResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/DirectorysForceCloseHandlesResponse.java deleted file mode 100644 index c3aaa1f5ce71c..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DirectorysForceCloseHandlesResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the forceCloseHandles operation. - */ -public final class DirectorysForceCloseHandlesResponse extends ResponseBase { - /** - * Creates an instance of DirectorysForceCloseHandlesResponse. - * - * @param request the request which resulted in this DirectorysForceCloseHandlesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public DirectorysForceCloseHandlesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, DirectoryForceCloseHandlesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectorysGetPropertiesResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/DirectorysGetPropertiesResponse.java deleted file mode 100644 index 1e2295bf6f6f0..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DirectorysGetPropertiesResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getProperties operation. - */ -public final class DirectorysGetPropertiesResponse extends ResponseBase { - /** - * Creates an instance of DirectorysGetPropertiesResponse. - * - * @param request the request which resulted in this DirectorysGetPropertiesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public DirectorysGetPropertiesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, DirectoryGetPropertiesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectorysListFilesAndDirectoriesSegmentResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/DirectorysListFilesAndDirectoriesSegmentResponse.java deleted file mode 100644 index cd8966e8fbf46..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DirectorysListFilesAndDirectoriesSegmentResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the listFilesAndDirectoriesSegment operation. - */ -public final class DirectorysListFilesAndDirectoriesSegmentResponse extends ResponseBase { - /** - * Creates an instance of DirectorysListFilesAndDirectoriesSegmentResponse. - * - * @param request the request which resulted in this DirectorysListFilesAndDirectoriesSegmentResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public DirectorysListFilesAndDirectoriesSegmentResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, ListFilesAndDirectoriesSegmentResponse value, DirectoryListFilesAndDirectoriesSegmentHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public ListFilesAndDirectoriesSegmentResponse value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectorysListHandlesResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/DirectorysListHandlesResponse.java deleted file mode 100644 index 267a2615ae5ef..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DirectorysListHandlesResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the listHandles operation. - */ -public final class DirectorysListHandlesResponse extends ResponseBase { - /** - * Creates an instance of DirectorysListHandlesResponse. - * - * @param request the request which resulted in this DirectorysListHandlesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public DirectorysListHandlesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, ListHandlesResponse value, DirectoryListHandlesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public ListHandlesResponse value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/DirectorysSetMetadataResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/DirectorysSetMetadataResponse.java deleted file mode 100644 index e3eee5271a136..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/DirectorysSetMetadataResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the setMetadata operation. - */ -public final class DirectorysSetMetadataResponse extends ResponseBase { - /** - * Creates an instance of DirectorysSetMetadataResponse. - * - * @param request the request which resulted in this DirectorysSetMetadataResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public DirectorysSetMetadataResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, DirectorySetMetadataHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileAbortCopyHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/FileAbortCopyHeaders.java deleted file mode 100644 index b5a7162058d7c..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileAbortCopyHeaders.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for AbortCopy operation. - */ -@JacksonXmlRootElement(localName = "File-AbortCopy-Headers") -public final class FileAbortCopyHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the FileAbortCopyHeaders object itself. - */ - public FileAbortCopyHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the FileAbortCopyHeaders object itself. - */ - public FileAbortCopyHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the FileAbortCopyHeaders object itself. - */ - public FileAbortCopyHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the FileAbortCopyHeaders object itself. - */ - public FileAbortCopyHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileCopyInfo.java b/storage/client/src/main/java/com/azure/storage/file/models/FileCopyInfo.java deleted file mode 100644 index cf1e02a688923..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileCopyInfo.java +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file.models; - -import java.time.OffsetDateTime; - -/** - * Contains copy information about a File in the storage File service. - */ -public final class FileCopyInfo { - private String eTag; - private OffsetDateTime lastModified; - private String copyId; - private CopyStatusType copyStatus; - - /** - * Creates an instance of copy information about a specific File. - * - * @param eTag Entity tag that corresponds to the directory. - * @param lastModified Last time the directory was modified. - * @param copyId String identifier for this copy operation. - * @param copyStatus State of the copy operation with these values: - * - success: the copy completed successfully. - * - pending: the copy is still in progress. - */ - public FileCopyInfo(final String eTag, final OffsetDateTime lastModified, final String copyId, final CopyStatusType copyStatus) { - this.eTag = eTag; - this.lastModified = lastModified; - this.copyId = copyId; - this.copyStatus = copyStatus; - } - - /** - * @return Entity tag that corresponds to the directory. - */ - public String eTag() { - return eTag; - } - - /** - * @return Last time the directory was modified. - */ - public OffsetDateTime lastModified() { - return lastModified; - } - - /** - * @return String identifier for this copy operation. - */ - public String copyId() { - return copyId; - } - - /** - * @return State of the copy operation with these values: - * - success: the copy completed successfully. - * - pending: the copy is still in progress. - */ - public CopyStatusType copyStatus() { - return copyStatus; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileCreateHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/FileCreateHeaders.java deleted file mode 100644 index f294bbef75fdd..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileCreateHeaders.java +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Create operation. - */ -@JacksonXmlRootElement(localName = "File-Create-Headers") -public final class FileCreateHeaders { - /* - * The ETag contains a value which represents the version of the file, in - * quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the share was last modified. Any operation - * that modifies the directory or its properties updates the last modified - * time. Operations on files do not affect the last modified time of the - * directory. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The value of this header is set to true if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. - */ - @JsonProperty(value = "x-ms-request-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value which represents the - * version of the file, in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value which represents the - * version of the file, in quotes. - * - * @param eTag the eTag value to set. - * @return the FileCreateHeaders object itself. - */ - public FileCreateHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the directory or its - * properties updates the last modified time. Operations on files do not - * affect the last modified time of the directory. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the directory or its - * properties updates the last modified time. Operations on files do not - * affect the last modified time of the directory. - * - * @param lastModified the lastModified value to set. - * @return the FileCreateHeaders object itself. - */ - public FileCreateHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the FileCreateHeaders object itself. - */ - public FileCreateHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the FileCreateHeaders object itself. - */ - public FileCreateHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the FileCreateHeaders object itself. - */ - public FileCreateHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the FileCreateHeaders object itself. - */ - public FileCreateHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the FileCreateHeaders object itself. - */ - public FileCreateHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileDeleteHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/FileDeleteHeaders.java deleted file mode 100644 index daf2668bd0521..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileDeleteHeaders.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Delete operation. - */ -@JacksonXmlRootElement(localName = "File-Delete-Headers") -public final class FileDeleteHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the FileDeleteHeaders object itself. - */ - public FileDeleteHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the FileDeleteHeaders object itself. - */ - public FileDeleteHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the FileDeleteHeaders object itself. - */ - public FileDeleteHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the FileDeleteHeaders object itself. - */ - public FileDeleteHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileDownloadHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/FileDownloadHeaders.java deleted file mode 100644 index df05458677164..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileDownloadHeaders.java +++ /dev/null @@ -1,782 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.annotations.HeaderCollection; -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.Map; - -/** - * Defines headers for Download operation. - */ -@JacksonXmlRootElement(localName = "File-Download-Headers") -public final class FileDownloadHeaders { - /* - * Returns the date and time the file was last modified. Any operation that - * modifies the file or its properties updates the last modified time. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * The metadata property. - */ - @HeaderCollection("x-ms-meta-") - private Map metadata; - - /* - * The number of bytes present in the response body. - */ - @JsonProperty(value = "Content-Length") - private Long contentLength; - - /* - * The content type specified for the file. The default content type is - * 'application/octet-stream' - */ - @JsonProperty(value = "Content-Type") - private String contentType; - - /* - * Indicates the range of bytes returned if the client requested a subset - * of the file by setting the Range request header. - */ - @JsonProperty(value = "Content-Range") - private String contentRange; - - /* - * The ETag contains a value that you can use to perform operations - * conditionally, in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * If the file has an MD5 hash and the request is to read the full file, - * this response header is returned so that the client can check for - * message content integrity. If the request is to read a specified range - * and the 'x-ms-range-get-content-md5' is set to true, then the request - * returns an MD5 hash for the range, as long as the range size is less - * than or equal to 4 MB. If neither of these sets of conditions is true, - * then no value is returned for the 'Content-MD5' header. - */ - @JsonProperty(value = "Content-MD5") - private byte[] contentMD5; - - /* - * Returns the value that was specified for the Content-Encoding request - * header. - */ - @JsonProperty(value = "Content-Encoding") - private String contentEncoding; - - /* - * Returned if it was previously specified for the file. - */ - @JsonProperty(value = "Cache-Control") - private String cacheControl; - - /* - * Returns the value that was specified for the 'x-ms-content-disposition' - * header and specifies how to process the response. - */ - @JsonProperty(value = "Content-Disposition") - private String contentDisposition; - - /* - * Returns the value that was specified for the Content-Language request - * header. - */ - @JsonProperty(value = "Content-Language") - private String contentLanguage; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * Indicates that the service supports requests for partial file content. - */ - @JsonProperty(value = "Accept-Ranges") - private String acceptRanges; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * Conclusion time of the last attempted Copy File operation where this - * file was the destination file. This value can specify the time of a - * completed, aborted, or failed copy attempt. - */ - @JsonProperty(value = "x-ms-copy-completion-time") - private DateTimeRfc1123 copyCompletionTime; - - /* - * Only appears when x-ms-copy-status is failed or pending. Describes cause - * of fatal or non-fatal copy operation failure. - */ - @JsonProperty(value = "x-ms-copy-status-description") - private String copyStatusDescription; - - /* - * String identifier for the last attempted Copy File operation where this - * file was the destination file. - */ - @JsonProperty(value = "x-ms-copy-id") - private String copyId; - - /* - * Contains the number of bytes copied and the total bytes in the source in - * the last attempted Copy File operation where this file was the - * destination file. Can show between 0 and Content-Length bytes copied. - */ - @JsonProperty(value = "x-ms-copy-progress") - private String copyProgress; - - /* - * URL up to 2KB in length that specifies the source file used in the last - * attempted Copy File operation where this file was the destination file. - */ - @JsonProperty(value = "x-ms-copy-source") - private String copySource; - - /* - * State of the copy operation identified by 'x-ms-copy-id'. Possible - * values include: 'pending', 'success', 'aborted', 'failed' - */ - @JsonProperty(value = "x-ms-copy-status") - private CopyStatusType copyStatus; - - /* - * If the file has a MD5 hash, and if request contains range header (Range - * or x-ms-range), this response header is returned with the value of the - * whole file's MD5 value. This value may or may not be equal to the value - * returned in Content-MD5 header, with the latter calculated from the - * requested range. - */ - @JsonProperty(value = "x-ms-content-md5") - private byte[] fileContentMD5; - - /* - * The value of this header is set to true if the file data and application - * metadata are completely encrypted using the specified algorithm. - * Otherwise, the value is set to false (when the file is unencrypted, or - * if only parts of the file/application metadata are encrypted). - */ - @JsonProperty(value = "x-ms-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the lastModified property: Returns the date and time the file was - * last modified. Any operation that modifies the file or its properties - * updates the last modified time. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the file was - * last modified. Any operation that modifies the file or its properties - * updates the last modified time. - * - * @param lastModified the lastModified value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the metadata property: The metadata property. - * - * @return the metadata value. - */ - public Map metadata() { - return this.metadata; - } - - /** - * Set the metadata property: The metadata property. - * - * @param metadata the metadata value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders metadata(Map metadata) { - this.metadata = metadata; - return this; - } - - /** - * Get the contentLength property: The number of bytes present in the - * response body. - * - * @return the contentLength value. - */ - public Long contentLength() { - return this.contentLength; - } - - /** - * Set the contentLength property: The number of bytes present in the - * response body. - * - * @param contentLength the contentLength value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders contentLength(Long contentLength) { - this.contentLength = contentLength; - return this; - } - - /** - * Get the contentType property: The content type specified for the file. - * The default content type is 'application/octet-stream'. - * - * @return the contentType value. - */ - public String contentType() { - return this.contentType; - } - - /** - * Set the contentType property: The content type specified for the file. - * The default content type is 'application/octet-stream'. - * - * @param contentType the contentType value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders contentType(String contentType) { - this.contentType = contentType; - return this; - } - - /** - * Get the contentRange property: Indicates the range of bytes returned if - * the client requested a subset of the file by setting the Range request - * header. - * - * @return the contentRange value. - */ - public String contentRange() { - return this.contentRange; - } - - /** - * Set the contentRange property: Indicates the range of bytes returned if - * the client requested a subset of the file by setting the Range request - * header. - * - * @param contentRange the contentRange value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders contentRange(String contentRange) { - this.contentRange = contentRange; - return this; - } - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @param eTag the eTag value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the contentMD5 property: If the file has an MD5 hash and the request - * is to read the full file, this response header is returned so that the - * client can check for message content integrity. If the request is to - * read a specified range and the 'x-ms-range-get-content-md5' is set to - * true, then the request returns an MD5 hash for the range, as long as the - * range size is less than or equal to 4 MB. If neither of these sets of - * conditions is true, then no value is returned for the 'Content-MD5' - * header. - * - * @return the contentMD5 value. - */ - public byte[] contentMD5() { - return Arrays.copyOf(this.contentMD5, this.contentMD5.length); - } - - /** - * Set the contentMD5 property: If the file has an MD5 hash and the request - * is to read the full file, this response header is returned so that the - * client can check for message content integrity. If the request is to - * read a specified range and the 'x-ms-range-get-content-md5' is set to - * true, then the request returns an MD5 hash for the range, as long as the - * range size is less than or equal to 4 MB. If neither of these sets of - * conditions is true, then no value is returned for the 'Content-MD5' - * header. - * - * @param contentMD5 the contentMD5 value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders contentMD5(byte[] contentMD5) { - this.contentMD5 = Arrays.copyOf(contentMD5, contentMD5.length); - return this; - } - - /** - * Get the contentEncoding property: Returns the value that was specified - * for the Content-Encoding request header. - * - * @return the contentEncoding value. - */ - public String contentEncoding() { - return this.contentEncoding; - } - - /** - * Set the contentEncoding property: Returns the value that was specified - * for the Content-Encoding request header. - * - * @param contentEncoding the contentEncoding value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders contentEncoding(String contentEncoding) { - this.contentEncoding = contentEncoding; - return this; - } - - /** - * Get the cacheControl property: Returned if it was previously specified - * for the file. - * - * @return the cacheControl value. - */ - public String cacheControl() { - return this.cacheControl; - } - - /** - * Set the cacheControl property: Returned if it was previously specified - * for the file. - * - * @param cacheControl the cacheControl value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders cacheControl(String cacheControl) { - this.cacheControl = cacheControl; - return this; - } - - /** - * Get the contentDisposition property: Returns the value that was - * specified for the 'x-ms-content-disposition' header and specifies how to - * process the response. - * - * @return the contentDisposition value. - */ - public String contentDisposition() { - return this.contentDisposition; - } - - /** - * Set the contentDisposition property: Returns the value that was - * specified for the 'x-ms-content-disposition' header and specifies how to - * process the response. - * - * @param contentDisposition the contentDisposition value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders contentDisposition(String contentDisposition) { - this.contentDisposition = contentDisposition; - return this; - } - - /** - * Get the contentLanguage property: Returns the value that was specified - * for the Content-Language request header. - * - * @return the contentLanguage value. - */ - public String contentLanguage() { - return this.contentLanguage; - } - - /** - * Set the contentLanguage property: Returns the value that was specified - * for the Content-Language request header. - * - * @param contentLanguage the contentLanguage value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders contentLanguage(String contentLanguage) { - this.contentLanguage = contentLanguage; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the acceptRanges property: Indicates that the service supports - * requests for partial file content. - * - * @return the acceptRanges value. - */ - public String acceptRanges() { - return this.acceptRanges; - } - - /** - * Set the acceptRanges property: Indicates that the service supports - * requests for partial file content. - * - * @param acceptRanges the acceptRanges value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders acceptRanges(String acceptRanges) { - this.acceptRanges = acceptRanges; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the copyCompletionTime property: Conclusion time of the last - * attempted Copy File operation where this file was the destination file. - * This value can specify the time of a completed, aborted, or failed copy - * attempt. - * - * @return the copyCompletionTime value. - */ - public OffsetDateTime copyCompletionTime() { - if (this.copyCompletionTime == null) { - return null; - } - return this.copyCompletionTime.dateTime(); - } - - /** - * Set the copyCompletionTime property: Conclusion time of the last - * attempted Copy File operation where this file was the destination file. - * This value can specify the time of a completed, aborted, or failed copy - * attempt. - * - * @param copyCompletionTime the copyCompletionTime value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders copyCompletionTime(OffsetDateTime copyCompletionTime) { - if (copyCompletionTime == null) { - this.copyCompletionTime = null; - } else { - this.copyCompletionTime = new DateTimeRfc1123(copyCompletionTime); - } - return this; - } - - /** - * Get the copyStatusDescription property: Only appears when - * x-ms-copy-status is failed or pending. Describes cause of fatal or - * non-fatal copy operation failure. - * - * @return the copyStatusDescription value. - */ - public String copyStatusDescription() { - return this.copyStatusDescription; - } - - /** - * Set the copyStatusDescription property: Only appears when - * x-ms-copy-status is failed or pending. Describes cause of fatal or - * non-fatal copy operation failure. - * - * @param copyStatusDescription the copyStatusDescription value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders copyStatusDescription(String copyStatusDescription) { - this.copyStatusDescription = copyStatusDescription; - return this; - } - - /** - * Get the copyId property: String identifier for the last attempted Copy - * File operation where this file was the destination file. - * - * @return the copyId value. - */ - public String copyId() { - return this.copyId; - } - - /** - * Set the copyId property: String identifier for the last attempted Copy - * File operation where this file was the destination file. - * - * @param copyId the copyId value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders copyId(String copyId) { - this.copyId = copyId; - return this; - } - - /** - * Get the copyProgress property: Contains the number of bytes copied and - * the total bytes in the source in the last attempted Copy File operation - * where this file was the destination file. Can show between 0 and - * Content-Length bytes copied. - * - * @return the copyProgress value. - */ - public String copyProgress() { - return this.copyProgress; - } - - /** - * Set the copyProgress property: Contains the number of bytes copied and - * the total bytes in the source in the last attempted Copy File operation - * where this file was the destination file. Can show between 0 and - * Content-Length bytes copied. - * - * @param copyProgress the copyProgress value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders copyProgress(String copyProgress) { - this.copyProgress = copyProgress; - return this; - } - - /** - * Get the copySource property: URL up to 2KB in length that specifies the - * source file used in the last attempted Copy File operation where this - * file was the destination file. - * - * @return the copySource value. - */ - public String copySource() { - return this.copySource; - } - - /** - * Set the copySource property: URL up to 2KB in length that specifies the - * source file used in the last attempted Copy File operation where this - * file was the destination file. - * - * @param copySource the copySource value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders copySource(String copySource) { - this.copySource = copySource; - return this; - } - - /** - * Get the copyStatus property: State of the copy operation identified by - * 'x-ms-copy-id'. Possible values include: 'pending', 'success', - * 'aborted', 'failed'. - * - * @return the copyStatus value. - */ - public CopyStatusType copyStatus() { - return this.copyStatus; - } - - /** - * Set the copyStatus property: State of the copy operation identified by - * 'x-ms-copy-id'. Possible values include: 'pending', 'success', - * 'aborted', 'failed'. - * - * @param copyStatus the copyStatus value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders copyStatus(CopyStatusType copyStatus) { - this.copyStatus = copyStatus; - return this; - } - - /** - * Get the fileContentMD5 property: If the file has a MD5 hash, and if - * request contains range header (Range or x-ms-range), this response - * header is returned with the value of the whole file's MD5 value. This - * value may or may not be equal to the value returned in Content-MD5 - * header, with the latter calculated from the requested range. - * - * @return the fileContentMD5 value. - */ - public byte[] fileContentMD5() { - return Arrays.copyOf(this.fileContentMD5, this.fileContentMD5.length); - } - - /** - * Set the fileContentMD5 property: If the file has a MD5 hash, and if - * request contains range header (Range or x-ms-range), this response - * header is returned with the value of the whole file's MD5 value. This - * value may or may not be equal to the value returned in Content-MD5 - * header, with the latter calculated from the requested range. - * - * @param fileContentMD5 the fileContentMD5 value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders fileContentMD5(byte[] fileContentMD5) { - this.fileContentMD5 = Arrays.copyOf(fileContentMD5, fileContentMD5.length); - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the file data and application metadata are completely encrypted - * using the specified algorithm. Otherwise, the value is set to false - * (when the file is unencrypted, or if only parts of the file/application - * metadata are encrypted). - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the file data and application metadata are completely encrypted - * using the specified algorithm. Otherwise, the value is set to false - * (when the file is unencrypted, or if only parts of the file/application - * metadata are encrypted). - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the FileDownloadHeaders object itself. - */ - public FileDownloadHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileDownloadInfo.java b/storage/client/src/main/java/com/azure/storage/file/models/FileDownloadInfo.java deleted file mode 100644 index a1e4dbe9c3167..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileDownloadInfo.java +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file.models; - -import io.netty.buffer.ByteBuf; -import java.time.OffsetDateTime; -import java.util.Map; -import reactor.core.publisher.Flux; - -/** - * Contains download information about a File in the storage File service. - */ -public final class FileDownloadInfo { - private String eTag; - private OffsetDateTime lastModified; - private Map metadata; - private Long contentLength; - private String contentType; - private String contentRange; - private Flux body; - - /** - * Creates an instance of download information about a specific File. - * - * @param eTag Entity tag that corresponds to the directory. - * @param lastModified Last time the directory was modified. - * @param metadata A set of name-value pairs associated with this file as user-defined metadata. - * @param contentLength The number of bytes present in the response body. - * @param contentType The content type specified for the file. The default content type is application/octet-stream. - * @param contentRange Indicates the range of bytes returned if the client requested a subset of the file by setting the Range request header. - * @param body The download request body. - */ - public FileDownloadInfo(final String eTag, final OffsetDateTime lastModified, final Map metadata, final Long contentLength, final String contentType, final String contentRange, final Flux body) { - this.eTag = eTag; - this.lastModified = lastModified; - this.metadata = metadata; - this.contentLength = contentLength; - this.contentType = contentType; - this.contentRange = contentRange; - this.body = body; - } - - /** - * @return Entity tag that corresponds to the directory. - */ - public String eTag() { - return eTag; - } - - /** - * @return Last time the directory was modified. - */ - public OffsetDateTime lastModified() { - return lastModified; - } - - /** - * @return A set of name-value pairs associated with this file as user-defined metadata. - */ - public Map metadata() { - return metadata; - } - - /** - * @return The number of bytes present in the response body. - */ - public Long contentLength() { - return contentLength; - } - - /** - * @return The content type specified for the file. The default content type is application/octet-stream. - */ - public String contentType() { - return contentType; - } - - /** - * @return The range of bytes returned if the client requested a subset of the file by setting the Range request header. - */ - public String contentRange() { - return contentRange; - } - - /** - * @return The download request body. - */ - public Flux body() { - return body; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileForceCloseHandlesHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/FileForceCloseHandlesHeaders.java deleted file mode 100644 index 39f245c7d1116..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileForceCloseHandlesHeaders.java +++ /dev/null @@ -1,194 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for ForceCloseHandles operation. - */ -@JacksonXmlRootElement(localName = "File-ForceCloseHandles-Headers") -public final class FileForceCloseHandlesHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * A string describing next handle to be closed. It is returned when more - * handles need to be closed to complete the request. - */ - @JsonProperty(value = "x-ms-marker") - private String marker; - - /* - * Contains count of number of handles closed. - */ - @JsonProperty(value = "x-ms-number-of-handles-closed") - private Integer numberOfHandlesClosed; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the FileForceCloseHandlesHeaders object itself. - */ - public FileForceCloseHandlesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the FileForceCloseHandlesHeaders object itself. - */ - public FileForceCloseHandlesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the FileForceCloseHandlesHeaders object itself. - */ - public FileForceCloseHandlesHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the marker property: A string describing next handle to be closed. - * It is returned when more handles need to be closed to complete the - * request. - * - * @return the marker value. - */ - public String marker() { - return this.marker; - } - - /** - * Set the marker property: A string describing next handle to be closed. - * It is returned when more handles need to be closed to complete the - * request. - * - * @param marker the marker value to set. - * @return the FileForceCloseHandlesHeaders object itself. - */ - public FileForceCloseHandlesHeaders marker(String marker) { - this.marker = marker; - return this; - } - - /** - * Get the numberOfHandlesClosed property: Contains count of number of - * handles closed. - * - * @return the numberOfHandlesClosed value. - */ - public Integer numberOfHandlesClosed() { - return this.numberOfHandlesClosed; - } - - /** - * Set the numberOfHandlesClosed property: Contains count of number of - * handles closed. - * - * @param numberOfHandlesClosed the numberOfHandlesClosed value to set. - * @return the FileForceCloseHandlesHeaders object itself. - */ - public FileForceCloseHandlesHeaders numberOfHandlesClosed(Integer numberOfHandlesClosed) { - this.numberOfHandlesClosed = numberOfHandlesClosed; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the FileForceCloseHandlesHeaders object itself. - */ - public FileForceCloseHandlesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileGetPropertiesHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/FileGetPropertiesHeaders.java deleted file mode 100644 index ff397f6cd7ce1..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileGetPropertiesHeaders.java +++ /dev/null @@ -1,709 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.annotations.HeaderCollection; -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; -import java.util.Arrays; -import java.util.Map; - -/** - * Defines headers for GetProperties operation. - */ -@JacksonXmlRootElement(localName = "File-GetProperties-Headers") -public final class FileGetPropertiesHeaders { - /* - * Returns the date and time the file was last modified. The date format - * follows RFC 1123. Any operation that modifies the file or its properties - * updates the last modified time. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * The metadata property. - */ - @HeaderCollection("x-ms-meta-") - private Map metadata; - - /* - * Returns the type File. Reserved for future use. Possible values include: - * 'File' - */ - @JsonProperty(value = "x-ms-type") - private String fileType; - - /* - * The size of the file in bytes. This header returns the value of the - * 'x-ms-content-length' header that is stored with the file. - */ - @JsonProperty(value = "Content-Length") - private Long contentLength; - - /* - * The content type specified for the file. The default content type is - * 'application/octet-stream' - */ - @JsonProperty(value = "Content-Type") - private String contentType; - - /* - * The ETag contains a value that you can use to perform operations - * conditionally, in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * If the Content-MD5 header has been set for the file, the Content-MD5 - * response header is returned so that the client can check for message - * content integrity. - */ - @JsonProperty(value = "Content-MD5") - private byte[] contentMD5; - - /* - * If the Content-Encoding request header has previously been set for the - * file, the Content-Encoding value is returned in this header. - */ - @JsonProperty(value = "Content-Encoding") - private String contentEncoding; - - /* - * If the Cache-Control request header has previously been set for the - * file, the Cache-Control value is returned in this header. - */ - @JsonProperty(value = "Cache-Control") - private String cacheControl; - - /* - * Returns the value that was specified for the 'x-ms-content-disposition' - * header and specifies how to process the response. - */ - @JsonProperty(value = "Content-Disposition") - private String contentDisposition; - - /* - * Returns the value that was specified for the Content-Language request - * header. - */ - @JsonProperty(value = "Content-Language") - private String contentLanguage; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * Conclusion time of the last attempted Copy File operation where this - * file was the destination file. This value can specify the time of a - * completed, aborted, or failed copy attempt. - */ - @JsonProperty(value = "x-ms-copy-completion-time") - private DateTimeRfc1123 copyCompletionTime; - - /* - * Only appears when x-ms-copy-status is failed or pending. Describes cause - * of fatal or non-fatal copy operation failure. - */ - @JsonProperty(value = "x-ms-copy-status-description") - private String copyStatusDescription; - - /* - * String identifier for the last attempted Copy File operation where this - * file was the destination file. - */ - @JsonProperty(value = "x-ms-copy-id") - private String copyId; - - /* - * Contains the number of bytes copied and the total bytes in the source in - * the last attempted Copy File operation where this file was the - * destination file. Can show between 0 and Content-Length bytes copied. - */ - @JsonProperty(value = "x-ms-copy-progress") - private String copyProgress; - - /* - * URL up to 2KB in length that specifies the source file used in the last - * attempted Copy File operation where this file was the destination file. - */ - @JsonProperty(value = "x-ms-copy-source") - private String copySource; - - /* - * State of the copy operation identified by 'x-ms-copy-id'. Possible - * values include: 'pending', 'success', 'aborted', 'failed' - */ - @JsonProperty(value = "x-ms-copy-status") - private CopyStatusType copyStatus; - - /* - * The value of this header is set to true if the file data and application - * metadata are completely encrypted using the specified algorithm. - * Otherwise, the value is set to false (when the file is unencrypted, or - * if only parts of the file/application metadata are encrypted). - */ - @JsonProperty(value = "x-ms-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the lastModified property: Returns the date and time the file was - * last modified. The date format follows RFC 1123. Any operation that - * modifies the file or its properties updates the last modified time. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the file was - * last modified. The date format follows RFC 1123. Any operation that - * modifies the file or its properties updates the last modified time. - * - * @param lastModified the lastModified value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the metadata property: The metadata property. - * - * @return the metadata value. - */ - public Map metadata() { - return this.metadata; - } - - /** - * Set the metadata property: The metadata property. - * - * @param metadata the metadata value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders metadata(Map metadata) { - this.metadata = metadata; - return this; - } - - /** - * Get the fileType property: Returns the type File. Reserved for future - * use. Possible values include: 'File'. - * - * @return the fileType value. - */ - public String fileType() { - return this.fileType; - } - - /** - * Set the fileType property: Returns the type File. Reserved for future - * use. Possible values include: 'File'. - * - * @param fileType the fileType value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders fileType(String fileType) { - this.fileType = fileType; - return this; - } - - /** - * Get the contentLength property: The size of the file in bytes. This - * header returns the value of the 'x-ms-content-length' header that is - * stored with the file. - * - * @return the contentLength value. - */ - public Long contentLength() { - return this.contentLength; - } - - /** - * Set the contentLength property: The size of the file in bytes. This - * header returns the value of the 'x-ms-content-length' header that is - * stored with the file. - * - * @param contentLength the contentLength value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders contentLength(Long contentLength) { - this.contentLength = contentLength; - return this; - } - - /** - * Get the contentType property: The content type specified for the file. - * The default content type is 'application/octet-stream'. - * - * @return the contentType value. - */ - public String contentType() { - return this.contentType; - } - - /** - * Set the contentType property: The content type specified for the file. - * The default content type is 'application/octet-stream'. - * - * @param contentType the contentType value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders contentType(String contentType) { - this.contentType = contentType; - return this; - } - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @param eTag the eTag value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the contentMD5 property: If the Content-MD5 header has been set for - * the file, the Content-MD5 response header is returned so that the client - * can check for message content integrity. - * - * @return the contentMD5 value. - */ - public byte[] contentMD5() { - return Arrays.copyOf(this.contentMD5, this.contentMD5.length); - } - - /** - * Set the contentMD5 property: If the Content-MD5 header has been set for - * the file, the Content-MD5 response header is returned so that the client - * can check for message content integrity. - * - * @param contentMD5 the contentMD5 value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders contentMD5(byte[] contentMD5) { - this.contentMD5 = Arrays.copyOf(contentMD5, contentMD5.length); - return this; - } - - /** - * Get the contentEncoding property: If the Content-Encoding request header - * has previously been set for the file, the Content-Encoding value is - * returned in this header. - * - * @return the contentEncoding value. - */ - public String contentEncoding() { - return this.contentEncoding; - } - - /** - * Set the contentEncoding property: If the Content-Encoding request header - * has previously been set for the file, the Content-Encoding value is - * returned in this header. - * - * @param contentEncoding the contentEncoding value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders contentEncoding(String contentEncoding) { - this.contentEncoding = contentEncoding; - return this; - } - - /** - * Get the cacheControl property: If the Cache-Control request header has - * previously been set for the file, the Cache-Control value is returned in - * this header. - * - * @return the cacheControl value. - */ - public String cacheControl() { - return this.cacheControl; - } - - /** - * Set the cacheControl property: If the Cache-Control request header has - * previously been set for the file, the Cache-Control value is returned in - * this header. - * - * @param cacheControl the cacheControl value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders cacheControl(String cacheControl) { - this.cacheControl = cacheControl; - return this; - } - - /** - * Get the contentDisposition property: Returns the value that was - * specified for the 'x-ms-content-disposition' header and specifies how to - * process the response. - * - * @return the contentDisposition value. - */ - public String contentDisposition() { - return this.contentDisposition; - } - - /** - * Set the contentDisposition property: Returns the value that was - * specified for the 'x-ms-content-disposition' header and specifies how to - * process the response. - * - * @param contentDisposition the contentDisposition value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders contentDisposition(String contentDisposition) { - this.contentDisposition = contentDisposition; - return this; - } - - /** - * Get the contentLanguage property: Returns the value that was specified - * for the Content-Language request header. - * - * @return the contentLanguage value. - */ - public String contentLanguage() { - return this.contentLanguage; - } - - /** - * Set the contentLanguage property: Returns the value that was specified - * for the Content-Language request header. - * - * @param contentLanguage the contentLanguage value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders contentLanguage(String contentLanguage) { - this.contentLanguage = contentLanguage; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the copyCompletionTime property: Conclusion time of the last - * attempted Copy File operation where this file was the destination file. - * This value can specify the time of a completed, aborted, or failed copy - * attempt. - * - * @return the copyCompletionTime value. - */ - public OffsetDateTime copyCompletionTime() { - if (this.copyCompletionTime == null) { - return null; - } - return this.copyCompletionTime.dateTime(); - } - - /** - * Set the copyCompletionTime property: Conclusion time of the last - * attempted Copy File operation where this file was the destination file. - * This value can specify the time of a completed, aborted, or failed copy - * attempt. - * - * @param copyCompletionTime the copyCompletionTime value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders copyCompletionTime(OffsetDateTime copyCompletionTime) { - if (copyCompletionTime == null) { - this.copyCompletionTime = null; - } else { - this.copyCompletionTime = new DateTimeRfc1123(copyCompletionTime); - } - return this; - } - - /** - * Get the copyStatusDescription property: Only appears when - * x-ms-copy-status is failed or pending. Describes cause of fatal or - * non-fatal copy operation failure. - * - * @return the copyStatusDescription value. - */ - public String copyStatusDescription() { - return this.copyStatusDescription; - } - - /** - * Set the copyStatusDescription property: Only appears when - * x-ms-copy-status is failed or pending. Describes cause of fatal or - * non-fatal copy operation failure. - * - * @param copyStatusDescription the copyStatusDescription value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders copyStatusDescription(String copyStatusDescription) { - this.copyStatusDescription = copyStatusDescription; - return this; - } - - /** - * Get the copyId property: String identifier for the last attempted Copy - * File operation where this file was the destination file. - * - * @return the copyId value. - */ - public String copyId() { - return this.copyId; - } - - /** - * Set the copyId property: String identifier for the last attempted Copy - * File operation where this file was the destination file. - * - * @param copyId the copyId value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders copyId(String copyId) { - this.copyId = copyId; - return this; - } - - /** - * Get the copyProgress property: Contains the number of bytes copied and - * the total bytes in the source in the last attempted Copy File operation - * where this file was the destination file. Can show between 0 and - * Content-Length bytes copied. - * - * @return the copyProgress value. - */ - public String copyProgress() { - return this.copyProgress; - } - - /** - * Set the copyProgress property: Contains the number of bytes copied and - * the total bytes in the source in the last attempted Copy File operation - * where this file was the destination file. Can show between 0 and - * Content-Length bytes copied. - * - * @param copyProgress the copyProgress value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders copyProgress(String copyProgress) { - this.copyProgress = copyProgress; - return this; - } - - /** - * Get the copySource property: URL up to 2KB in length that specifies the - * source file used in the last attempted Copy File operation where this - * file was the destination file. - * - * @return the copySource value. - */ - public String copySource() { - return this.copySource; - } - - /** - * Set the copySource property: URL up to 2KB in length that specifies the - * source file used in the last attempted Copy File operation where this - * file was the destination file. - * - * @param copySource the copySource value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders copySource(String copySource) { - this.copySource = copySource; - return this; - } - - /** - * Get the copyStatus property: State of the copy operation identified by - * 'x-ms-copy-id'. Possible values include: 'pending', 'success', - * 'aborted', 'failed'. - * - * @return the copyStatus value. - */ - public CopyStatusType copyStatus() { - return this.copyStatus; - } - - /** - * Set the copyStatus property: State of the copy operation identified by - * 'x-ms-copy-id'. Possible values include: 'pending', 'success', - * 'aborted', 'failed'. - * - * @param copyStatus the copyStatus value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders copyStatus(CopyStatusType copyStatus) { - this.copyStatus = copyStatus; - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the file data and application metadata are completely encrypted - * using the specified algorithm. Otherwise, the value is set to false - * (when the file is unencrypted, or if only parts of the file/application - * metadata are encrypted). - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the file data and application metadata are completely encrypted - * using the specified algorithm. Otherwise, the value is set to false - * (when the file is unencrypted, or if only parts of the file/application - * metadata are encrypted). - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the FileGetPropertiesHeaders object itself. - */ - public FileGetPropertiesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileGetRangeListHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/FileGetRangeListHeaders.java deleted file mode 100644 index 61f16897c4fc4..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileGetRangeListHeaders.java +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for GetRangeList operation. - */ -@JacksonXmlRootElement(localName = "File-GetRangeList-Headers") -public final class FileGetRangeListHeaders { - /* - * The date/time that the file was last modified. Any operation that - * modifies the file, including an update of the file's metadata or - * properties, changes the file's last modified time. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * The ETag contains a value which represents the version of the file, in - * quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * The size of the file in bytes. - */ - @JsonProperty(value = "x-ms-content-length") - private Long fileContentLength; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the lastModified property: The date/time that the file was last - * modified. Any operation that modifies the file, including an update of - * the file's metadata or properties, changes the file's last modified - * time. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: The date/time that the file was last - * modified. Any operation that modifies the file, including an update of - * the file's metadata or properties, changes the file's last modified - * time. - * - * @param lastModified the lastModified value to set. - * @return the FileGetRangeListHeaders object itself. - */ - public FileGetRangeListHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the eTag property: The ETag contains a value which represents the - * version of the file, in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value which represents the - * version of the file, in quotes. - * - * @param eTag the eTag value to set. - * @return the FileGetRangeListHeaders object itself. - */ - public FileGetRangeListHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the fileContentLength property: The size of the file in bytes. - * - * @return the fileContentLength value. - */ - public Long fileContentLength() { - return this.fileContentLength; - } - - /** - * Set the fileContentLength property: The size of the file in bytes. - * - * @param fileContentLength the fileContentLength value to set. - * @return the FileGetRangeListHeaders object itself. - */ - public FileGetRangeListHeaders fileContentLength(Long fileContentLength) { - this.fileContentLength = fileContentLength; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the FileGetRangeListHeaders object itself. - */ - public FileGetRangeListHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the FileGetRangeListHeaders object itself. - */ - public FileGetRangeListHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the FileGetRangeListHeaders object itself. - */ - public FileGetRangeListHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the FileGetRangeListHeaders object itself. - */ - public FileGetRangeListHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileHTTPHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/FileHTTPHeaders.java deleted file mode 100644 index 01c69b3a9f299..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileHTTPHeaders.java +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.Arrays; - -/** - * Additional parameters for a set of operations, such as: Files_create, - * Files_setHTTPHeaders. - */ -@JacksonXmlRootElement(localName = "file-HTTP-headers") -public final class FileHTTPHeaders { - /* - * Sets the MIME content type of the file. The default type is - * 'application/octet-stream'. - */ - @JsonProperty(value = "fileContentType") - private String fileContentType; - - /* - * Specifies which content encodings have been applied to the file. - */ - @JsonProperty(value = "fileContentEncoding") - private String fileContentEncoding; - - /* - * Specifies the natural languages used by this resource. - */ - @JsonProperty(value = "fileContentLanguage") - private String fileContentLanguage; - - /* - * Sets the file's cache control. The File service stores this value but - * does not use or modify it. - */ - @JsonProperty(value = "fileCacheControl") - private String fileCacheControl; - - /* - * Sets the file's MD5 hash. - */ - @JsonProperty(value = "fileContentMD5") - private byte[] fileContentMD5; - - /* - * Sets the file's Content-Disposition header. - */ - @JsonProperty(value = "fileContentDisposition") - private String fileContentDisposition; - - /** - * Get the fileContentType property: Sets the MIME content type of the - * file. The default type is 'application/octet-stream'. - * - * @return the fileContentType value. - */ - public String fileContentType() { - return this.fileContentType; - } - - /** - * Set the fileContentType property: Sets the MIME content type of the - * file. The default type is 'application/octet-stream'. - * - * @param fileContentType the fileContentType value to set. - * @return the FileHTTPHeaders object itself. - */ - public FileHTTPHeaders fileContentType(String fileContentType) { - this.fileContentType = fileContentType; - return this; - } - - /** - * Get the fileContentEncoding property: Specifies which content encodings - * have been applied to the file. - * - * @return the fileContentEncoding value. - */ - public String fileContentEncoding() { - return this.fileContentEncoding; - } - - /** - * Set the fileContentEncoding property: Specifies which content encodings - * have been applied to the file. - * - * @param fileContentEncoding the fileContentEncoding value to set. - * @return the FileHTTPHeaders object itself. - */ - public FileHTTPHeaders fileContentEncoding(String fileContentEncoding) { - this.fileContentEncoding = fileContentEncoding; - return this; - } - - /** - * Get the fileContentLanguage property: Specifies the natural languages - * used by this resource. - * - * @return the fileContentLanguage value. - */ - public String fileContentLanguage() { - return this.fileContentLanguage; - } - - /** - * Set the fileContentLanguage property: Specifies the natural languages - * used by this resource. - * - * @param fileContentLanguage the fileContentLanguage value to set. - * @return the FileHTTPHeaders object itself. - */ - public FileHTTPHeaders fileContentLanguage(String fileContentLanguage) { - this.fileContentLanguage = fileContentLanguage; - return this; - } - - /** - * Get the fileCacheControl property: Sets the file's cache control. The - * File service stores this value but does not use or modify it. - * - * @return the fileCacheControl value. - */ - public String fileCacheControl() { - return this.fileCacheControl; - } - - /** - * Set the fileCacheControl property: Sets the file's cache control. The - * File service stores this value but does not use or modify it. - * - * @param fileCacheControl the fileCacheControl value to set. - * @return the FileHTTPHeaders object itself. - */ - public FileHTTPHeaders fileCacheControl(String fileCacheControl) { - this.fileCacheControl = fileCacheControl; - return this; - } - - /** - * Get the fileContentMD5 property: Sets the file's MD5 hash. - * - * @return the fileContentMD5 value. - */ - public byte[] fileContentMD5() { - return Arrays.copyOf(this.fileContentMD5, this.fileContentMD5.length); - } - - /** - * Set the fileContentMD5 property: Sets the file's MD5 hash. - * - * @param fileContentMD5 the fileContentMD5 value to set. - * @return the FileHTTPHeaders object itself. - */ - public FileHTTPHeaders fileContentMD5(byte[] fileContentMD5) { - this.fileContentMD5 = Arrays.copyOf(fileContentMD5, fileContentMD5.length); - return this; - } - - /** - * Get the fileContentDisposition property: Sets the file's - * Content-Disposition header. - * - * @return the fileContentDisposition value. - */ - public String fileContentDisposition() { - return this.fileContentDisposition; - } - - /** - * Set the fileContentDisposition property: Sets the file's - * Content-Disposition header. - * - * @param fileContentDisposition the fileContentDisposition value to set. - * @return the FileHTTPHeaders object itself. - */ - public FileHTTPHeaders fileContentDisposition(String fileContentDisposition) { - this.fileContentDisposition = fileContentDisposition; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileInfo.java b/storage/client/src/main/java/com/azure/storage/file/models/FileInfo.java deleted file mode 100644 index 371b5f9fdcbd2..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file.models; - -import java.time.OffsetDateTime; - -/** - * Contains information about a File in the storage File service. - */ -public final class FileInfo { - private String eTag; - private OffsetDateTime lastModified; - private Boolean isServerEncrypted; - - /** - * Creates an instance of information about a specific Directory. - * - * @param eTag Entity tag that corresponds to the directory. - * @param lastModified Last time the directory was modified. - * @param isServerEncrypted The value of this header is set to true if the directory metadata is completely encrypted using the specified algorithm. Otherwise, the value is set to false. - */ - public FileInfo(final String eTag, final OffsetDateTime lastModified, final Boolean isServerEncrypted) { - this.eTag = eTag; - this.lastModified = lastModified; - this.isServerEncrypted = isServerEncrypted; - } - - /** - * @return The entity tag that corresponds to the directory. - */ - public String eTag() { - return eTag; - } - - /** - * @return The last time the share was modified. - */ - public OffsetDateTime lastModified() { - return lastModified; - } - - /** - * @return The value of this header is true if the directory metadata is completely encrypted using the specified algorithm. Otherwise, the value is false. - */ - public Boolean isServerEncrypted() { - return isServerEncrypted; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileItem.java b/storage/client/src/main/java/com/azure/storage/file/models/FileItem.java deleted file mode 100644 index 267445aaf42d2..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileItem.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * A listed file item. - */ -@JacksonXmlRootElement(localName = "File") -public final class FileItem { - /* - * The name property. - */ - @JsonProperty(value = "Name", required = true) - private String name; - - /* - * The properties property. - */ - @JsonProperty(value = "Properties", required = true) - private FileProperty properties; - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: The name property. - * - * @param name the name value to set. - * @return the FileItem object itself. - */ - public FileItem name(String name) { - this.name = name; - return this; - } - - /** - * Get the properties property: The properties property. - * - * @return the properties value. - */ - public FileProperty properties() { - return this.properties; - } - - /** - * Set the properties property: The properties property. - * - * @param properties the properties value to set. - * @return the FileItem object itself. - */ - public FileItem properties(FileProperty properties) { - this.properties = properties; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileListHandlesHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/FileListHandlesHeaders.java deleted file mode 100644 index c972e5cc9db44..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileListHandlesHeaders.java +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for ListHandles operation. - */ -@JacksonXmlRootElement(localName = "File-ListHandles-Headers") -public final class FileListHandlesHeaders { - /* - * Specifies the format in which the results are returned. Currently this - * value is 'application/xml'. - */ - @JsonProperty(value = "Content-Type") - private String contentType; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the contentType property: Specifies the format in which the results - * are returned. Currently this value is 'application/xml'. - * - * @return the contentType value. - */ - public String contentType() { - return this.contentType; - } - - /** - * Set the contentType property: Specifies the format in which the results - * are returned. Currently this value is 'application/xml'. - * - * @param contentType the contentType value to set. - * @return the FileListHandlesHeaders object itself. - */ - public FileListHandlesHeaders contentType(String contentType) { - this.contentType = contentType; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the FileListHandlesHeaders object itself. - */ - public FileListHandlesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the FileListHandlesHeaders object itself. - */ - public FileListHandlesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the FileListHandlesHeaders object itself. - */ - public FileListHandlesHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the FileListHandlesHeaders object itself. - */ - public FileListHandlesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileProperties.java b/storage/client/src/main/java/com/azure/storage/file/models/FileProperties.java deleted file mode 100644 index f49180dfa0da9..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileProperties.java +++ /dev/null @@ -1,202 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.util.ImplUtils; -import java.time.OffsetDateTime; -import java.util.Map; - -/** - * Contains property information about a File in the storage File service. - */ -public final class FileProperties { - private String eTag; - private OffsetDateTime lastModified; - private Map metadata; - private String fileType; - private Long contentLength; - private String contentType; - private byte[] contentMD5; - private String contentEncoding; - private String cacheControl; - private String contentDisposition; - private OffsetDateTime copyCompletionTime; - private String copyStatusDescription; - private String copyId; - private String copyProgress; - private String copySource; - private CopyStatusType copyStatus; - private Boolean isServerEncrypted; - - /** - * Creates an instance of property information about a specific File. - * - * @param eTag Entity tag that corresponds to the directory. - * @param lastModified Last time the directory was modified. - * @param metadata A set of name-value pairs associated with this file as user-defined metadata. - * @param fileType Type of the file. - * @param contentLength The number of bytes present in the response body. - * @param contentType The content type specified for the file. The default content type is application/octet-stream. - * @param contentMD5 The MD5 hash of the file to check the message content integrity. - * @param contentEncoding This header returns the value that was specified for the Content-Encoding request header. - * @param cacheControl This header is returned if it was previously specified for the file. - * @param contentDisposition The value that was specified for the x-ms-content-disposition header and specifies how to process the response. - * @param copyCompletionTime Conclusion time of the last attempted Copy File operation where this file was the destination file. - * @param copyStatusDescription Appears when x-ms-copy-status is failed or pending. Describes cause of fatal or non-fatal copy operation failure. - * @param copyId String identifier for the last attempted Copy File operation where this file was the destination file. - * @param copyProgress Contains the number of bytes copied and the total bytes in the source in the last attempted Copy File operation where this file was the destination file. - * @param copySource URL up to 2KB in length that specifies the source file used in the last attempted Copy File operation where this file was the destination file. - * @param copyStatus State of the copy operation identified by x-ms-copy-id, with these values: - * - success: Copy completed successfully. - * - pending: Copy is in progress. Check x-ms-copy-status-description if intermittent, non-fatal errors impede copy progress but don't cause failure. - * - aborted: Copy was ended by Abort Copy File. - * - failed: Copy failed. See x-ms-copy-status-description for failure details. - * @param isServerEncrypted The value of this header is set to true if the file data and application metadata are completely encrypted using the specified algorithm. Otherwise, the value is set to false. - */ - public FileProperties(final String eTag, final OffsetDateTime lastModified, final Map metadata, - final String fileType, final Long contentLength, final String contentType, final byte[] contentMD5, - final String contentEncoding, final String cacheControl, final String contentDisposition, - final OffsetDateTime copyCompletionTime, final String copyStatusDescription, final String copyId, - final String copyProgress, final String copySource, final CopyStatusType copyStatus, final Boolean isServerEncrypted) { - this.eTag = eTag; - this.lastModified = lastModified; - this.metadata = metadata; - this.fileType = fileType; - this.contentLength = contentLength; - this.contentType = contentType; - this.contentMD5 = contentMD5; - this.contentEncoding = contentEncoding; - this.cacheControl = cacheControl; - this.contentDisposition = contentDisposition; - this.copyCompletionTime = copyCompletionTime; - this.copyStatusDescription = copyStatusDescription; - this.copyId = copyId; - this.copyProgress = copyProgress; - this.copySource = copySource; - this.copyStatus = copyStatus; - this.isServerEncrypted = isServerEncrypted; - } - - /** - * @return Entity tag that corresponds to the directory. - */ - public String eTag() { - return eTag; - } - - /** - * @return Last time the directory was modified. - */ - public OffsetDateTime lastModified() { - return lastModified; - } - - /** - * @return A set of name-value pairs associated with this file as user-defined metadata. - */ - public Map metadata() { - return metadata; - } - - /** - * @return The number of bytes present in the response body. - */ - public Long contentLength() { - return contentLength; - } - - /** - * @return The type of the file. - */ - public String fileType() { - return fileType; - } - /** - * @return The content type specified for the file. The default content type is application/octet-stream. - */ - public String contentType() { - return contentType; - } - - /** - * @return The MD5 hash of the file. - */ - public byte[] contentMD5() { - return ImplUtils.clone(contentMD5); - } - - /** - * @return The value that was specified for the Content-Encoding request header. - */ - public String contentEncoding() { - return contentEncoding; - } - - /** - * @return This header is returned if it was previously specified for the file. - */ - public String cacheControl() { - return cacheControl; - } - - /** - * @return The value that was specified for the x-ms-content-disposition header and specifies how to process the response. - */ - public String contentDisposition() { - return contentDisposition; - } - - /** - * @return Conclusion time of the last attempted Copy File operation where this file was the destination file. - */ - public OffsetDateTime copyCompletionTime() { - return copyCompletionTime; - } - - /** - * @return When x-ms-copy-status is failed or pending. Describes cause of fatal or non-fatal copy operation failure. - */ - public String copyStatusDescription() { - return copyStatusDescription; - } - - /** - * @return String identifier for the last attempted Copy File operation where this file was the destination file. - */ - public String copyId() { - return copyId; - } - - /** - * @return The number of bytes copied and the total bytes in the source in the last attempted Copy File operation where this file was the destination file. - */ - public String copyProgress() { - return copyProgress; - } - - /** - * @return URL up to 2KB in length that specifies the source file used in the last attempted Copy File operation where this file was the destination file. - */ - public String copySource() { - return copySource; - } - - /** - * @return State of the copy operation identified by x-ms-copy-id, with these values: - * - success: Copy completed successfully. - * - pending: Copy is in progress. Check x-ms-copy-status-description if intermittent, non-fatal errors impede copy progress but don't cause failure. - * - aborted: Copy was ended by Abort Copy File. - * - failed: Copy failed. See x-ms-copy-status-description for failure details. - */ - public CopyStatusType copyStatus() { - return copyStatus; - } - - /** - * @return True if the file data and application metadata are completely encrypted using the specified algorithm. Otherwise, return false. - */ - public Boolean isServerEncrypted() { - return isServerEncrypted; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileProperty.java b/storage/client/src/main/java/com/azure/storage/file/models/FileProperty.java deleted file mode 100644 index f045b9e209d79..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileProperty.java +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * File properties. - */ -@JacksonXmlRootElement(localName = "FileProperty") -public final class FileProperty { - /* - * Content length of the file. This value may not be up-to-date since an - * SMB client may have modified the file locally. The value of - * Content-Length may not reflect that fact until the handle is closed or - * the op-lock is broken. To retrieve current property values, call Get - * File Properties. - */ - @JsonProperty(value = "Content-Length", required = true) - private long contentLength; - - /** - * Get the contentLength property: Content length of the file. This value - * may not be up-to-date since an SMB client may have modified the file - * locally. The value of Content-Length may not reflect that fact until the - * handle is closed or the op-lock is broken. To retrieve current property - * values, call Get File Properties. - * - * @return the contentLength value. - */ - public long contentLength() { - return this.contentLength; - } - - /** - * Set the contentLength property: Content length of the file. This value - * may not be up-to-date since an SMB client may have modified the file - * locally. The value of Content-Length may not reflect that fact until the - * handle is closed or the op-lock is broken. To retrieve current property - * values, call Get File Properties. - * - * @param contentLength the contentLength value to set. - * @return the FileProperty object itself. - */ - public FileProperty contentLength(long contentLength) { - this.contentLength = contentLength; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileRangeWriteType.java b/storage/client/src/main/java/com/azure/storage/file/models/FileRangeWriteType.java deleted file mode 100644 index 6bce222b4eeae..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileRangeWriteType.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for FileRangeWriteType. - */ -public enum FileRangeWriteType { - /** - * Enum value update. - */ - UPDATE("update"), - - /** - * Enum value clear. - */ - CLEAR("clear"); - - /** - * The actual serialized value for a FileRangeWriteType instance. - */ - private final String value; - - FileRangeWriteType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a FileRangeWriteType instance. - * - * @param value the serialized value to parse. - * @return the parsed FileRangeWriteType object, or null if unable to parse. - */ - @JsonCreator - public static FileRangeWriteType fromString(String value) { - FileRangeWriteType[] items = FileRangeWriteType.values(); - for (FileRangeWriteType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileRef.java b/storage/client/src/main/java/com/azure/storage/file/models/FileRef.java deleted file mode 100644 index 1db76cbdffea0..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileRef.java +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file.models; - -/** - * Contains file or directory reference information in the storage File service. - */ -public final class FileRef { - private String name; - private boolean isDirectory; - private FileProperty fileProperty; - - /** - * Creates an instance of file or directory reference information about a specific Share. - * - * @param name Name of the file or the directory. - * @param isDirectory A boolean set to true if the reference is a directory, false if the reference is a file. - * @param fileProperty Property of a file. Pass {@code null} if the reference is a directory. - */ - public FileRef(final String name, final boolean isDirectory, final FileProperty fileProperty) { - this.name = name; - this.isDirectory = isDirectory; - this.fileProperty = fileProperty; - } - - - /** - * @return Name of the file or the directory. - */ - public String name() { - return name; - } - - /** - * @return True if the reference is a directory, or false if the reference is a file. - */ - public boolean isDirectory() { - return isDirectory; - } - - /** - * @return Property of a file. Return {@code null} if the reference is a directory. - */ - public FileProperty fileProperties() { - return fileProperty; - } - -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileServiceProperties.java b/storage/client/src/main/java/com/azure/storage/file/models/FileServiceProperties.java deleted file mode 100644 index ef42bbb4becf8..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileServiceProperties.java +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.ArrayList; -import java.util.List; - -/** - * Storage service properties. - */ -@JacksonXmlRootElement(localName = "StorageServiceProperties") -public final class FileServiceProperties { - /* - * A summary of request statistics grouped by API in hourly aggregates for - * files. - */ - @JsonProperty(value = "HourMetrics") - private Metrics hourMetrics; - - /* - * A summary of request statistics grouped by API in minute aggregates for - * files. - */ - @JsonProperty(value = "MinuteMetrics") - private Metrics minuteMetrics; - - private static final class CorsWrapper { - @JacksonXmlProperty(localName = "CorsRule") - private final List items; - - @JsonCreator - private CorsWrapper(@JacksonXmlProperty(localName = "CorsRule") List items) { - this.items = items; - } - } - - /* - * The set of CORS rules. - */ - @JsonProperty(value = "Cors") - private CorsWrapper cors; - - /** - * Get the hourMetrics property: A summary of request statistics grouped by - * API in hourly aggregates for files. - * - * @return the hourMetrics value. - */ - public Metrics hourMetrics() { - return this.hourMetrics; - } - - /** - * Set the hourMetrics property: A summary of request statistics grouped by - * API in hourly aggregates for files. - * - * @param hourMetrics the hourMetrics value to set. - * @return the FileServiceProperties object itself. - */ - public FileServiceProperties hourMetrics(Metrics hourMetrics) { - this.hourMetrics = hourMetrics; - return this; - } - - /** - * Get the minuteMetrics property: A summary of request statistics grouped - * by API in minute aggregates for files. - * - * @return the minuteMetrics value. - */ - public Metrics minuteMetrics() { - return this.minuteMetrics; - } - - /** - * Set the minuteMetrics property: A summary of request statistics grouped - * by API in minute aggregates for files. - * - * @param minuteMetrics the minuteMetrics value to set. - * @return the FileServiceProperties object itself. - */ - public FileServiceProperties minuteMetrics(Metrics minuteMetrics) { - this.minuteMetrics = minuteMetrics; - return this; - } - - /** - * Get the cors property: The set of CORS rules. - * - * @return the cors value. - */ - public List cors() { - if (this.cors == null) { - this.cors = new CorsWrapper(new ArrayList()); - } - return this.cors.items; - } - - /** - * Set the cors property: The set of CORS rules. - * - * @param cors the cors value to set. - * @return the FileServiceProperties object itself. - */ - public FileServiceProperties cors(List cors) { - this.cors = new CorsWrapper(cors); - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileSetHTTPHeadersHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/FileSetHTTPHeadersHeaders.java deleted file mode 100644 index 178e2f0cd66ba..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileSetHTTPHeadersHeaders.java +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for SetHTTPHeaders operation. - */ -@JacksonXmlRootElement(localName = "File-SetHTTPHeaders-Headers") -public final class FileSetHTTPHeadersHeaders { - /* - * The ETag contains a value which represents the version of the file, in - * quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the directory was last modified. Any operation - * that modifies the directory or its properties updates the last modified - * time. Operations on files do not affect the last modified time of the - * directory. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The value of this header is set to true if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. - */ - @JsonProperty(value = "x-ms-request-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value which represents the - * version of the file, in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value which represents the - * version of the file, in quotes. - * - * @param eTag the eTag value to set. - * @return the FileSetHTTPHeadersHeaders object itself. - */ - public FileSetHTTPHeadersHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the directory - * was last modified. Any operation that modifies the directory or its - * properties updates the last modified time. Operations on files do not - * affect the last modified time of the directory. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the directory - * was last modified. Any operation that modifies the directory or its - * properties updates the last modified time. Operations on files do not - * affect the last modified time of the directory. - * - * @param lastModified the lastModified value to set. - * @return the FileSetHTTPHeadersHeaders object itself. - */ - public FileSetHTTPHeadersHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the FileSetHTTPHeadersHeaders object itself. - */ - public FileSetHTTPHeadersHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the FileSetHTTPHeadersHeaders object itself. - */ - public FileSetHTTPHeadersHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the FileSetHTTPHeadersHeaders object itself. - */ - public FileSetHTTPHeadersHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the FileSetHTTPHeadersHeaders object itself. - */ - public FileSetHTTPHeadersHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the FileSetHTTPHeadersHeaders object itself. - */ - public FileSetHTTPHeadersHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileSetMetadataHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/FileSetMetadataHeaders.java deleted file mode 100644 index 98fa0ac8d2dc7..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileSetMetadataHeaders.java +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for SetMetadata operation. - */ -@JacksonXmlRootElement(localName = "File-SetMetadata-Headers") -public final class FileSetMetadataHeaders { - /* - * The ETag contains a value which represents the version of the file, in - * quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The value of this header is set to true if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. - */ - @JsonProperty(value = "x-ms-request-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value which represents the - * version of the file, in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value which represents the - * version of the file, in quotes. - * - * @param eTag the eTag value to set. - * @return the FileSetMetadataHeaders object itself. - */ - public FileSetMetadataHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the FileSetMetadataHeaders object itself. - */ - public FileSetMetadataHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the FileSetMetadataHeaders object itself. - */ - public FileSetMetadataHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the FileSetMetadataHeaders object itself. - */ - public FileSetMetadataHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the FileSetMetadataHeaders object itself. - */ - public FileSetMetadataHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the FileSetMetadataHeaders object itself. - */ - public FileSetMetadataHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileStartCopyHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/FileStartCopyHeaders.java deleted file mode 100644 index 939ed8e062949..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileStartCopyHeaders.java +++ /dev/null @@ -1,266 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for StartCopy operation. - */ -@JacksonXmlRootElement(localName = "File-StartCopy-Headers") -public final class FileStartCopyHeaders { - /* - * If the copy is completed, contains the ETag of the destination file. If - * the copy is not complete, contains the ETag of the empty file created at - * the start of the copy. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date/time that the copy operation to the destination file - * completed. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * String identifier for this copy operation. Use with Get File or Get File - * Properties to check the status of this copy operation, or pass to Abort - * Copy File to abort a pending copy. - */ - @JsonProperty(value = "x-ms-copy-id") - private String copyId; - - /* - * State of the copy operation identified by x-ms-copy-id. Possible values - * include: 'pending', 'success', 'aborted', 'failed' - */ - @JsonProperty(value = "x-ms-copy-status") - private CopyStatusType copyStatus; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: If the copy is completed, contains the ETag of - * the destination file. If the copy is not complete, contains the ETag of - * the empty file created at the start of the copy. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: If the copy is completed, contains the ETag of - * the destination file. If the copy is not complete, contains the ETag of - * the empty file created at the start of the copy. - * - * @param eTag the eTag value to set. - * @return the FileStartCopyHeaders object itself. - */ - public FileStartCopyHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date/time that the copy - * operation to the destination file completed. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date/time that the copy - * operation to the destination file completed. - * - * @param lastModified the lastModified value to set. - * @return the FileStartCopyHeaders object itself. - */ - public FileStartCopyHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the FileStartCopyHeaders object itself. - */ - public FileStartCopyHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the FileStartCopyHeaders object itself. - */ - public FileStartCopyHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the FileStartCopyHeaders object itself. - */ - public FileStartCopyHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the copyId property: String identifier for this copy operation. Use - * with Get File or Get File Properties to check the status of this copy - * operation, or pass to Abort Copy File to abort a pending copy. - * - * @return the copyId value. - */ - public String copyId() { - return this.copyId; - } - - /** - * Set the copyId property: String identifier for this copy operation. Use - * with Get File or Get File Properties to check the status of this copy - * operation, or pass to Abort Copy File to abort a pending copy. - * - * @param copyId the copyId value to set. - * @return the FileStartCopyHeaders object itself. - */ - public FileStartCopyHeaders copyId(String copyId) { - this.copyId = copyId; - return this; - } - - /** - * Get the copyStatus property: State of the copy operation identified by - * x-ms-copy-id. Possible values include: 'pending', 'success', 'aborted', - * 'failed'. - * - * @return the copyStatus value. - */ - public CopyStatusType copyStatus() { - return this.copyStatus; - } - - /** - * Set the copyStatus property: State of the copy operation identified by - * x-ms-copy-id. Possible values include: 'pending', 'success', 'aborted', - * 'failed'. - * - * @param copyStatus the copyStatus value to set. - * @return the FileStartCopyHeaders object itself. - */ - public FileStartCopyHeaders copyStatus(CopyStatusType copyStatus) { - this.copyStatus = copyStatus; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the FileStartCopyHeaders object itself. - */ - public FileStartCopyHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileUploadInfo.java b/storage/client/src/main/java/com/azure/storage/file/models/FileUploadInfo.java deleted file mode 100644 index 6d48aac73be1e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileUploadInfo.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.util.ImplUtils; -import java.time.OffsetDateTime; - -public final class FileUploadInfo { - private String eTag; - private OffsetDateTime lastModified; - private byte[] contentMD5; - private Boolean isServerEncrypted; - - public FileUploadInfo(final String eTag, final OffsetDateTime lastModified, final byte[] contentMD5, final Boolean isServerEncrypted) { - this.eTag = eTag; - this.lastModified = lastModified; - this.contentMD5 = contentMD5; - this.isServerEncrypted = isServerEncrypted; - } - - public String eTag() { - return eTag; - } - - public OffsetDateTime lastModified() { - return lastModified; - } - - public byte[] contentMD5() { - return contentMD5; - } - - public Boolean isServerEncrypted() { - return isServerEncrypted; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FileUploadRangeHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/FileUploadRangeHeaders.java deleted file mode 100644 index 686014ab74e59..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FileUploadRangeHeaders.java +++ /dev/null @@ -1,274 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; -import java.util.Arrays; - -/** - * Defines headers for UploadRange operation. - */ -@JacksonXmlRootElement(localName = "File-UploadRange-Headers") -public final class FileUploadRangeHeaders { - /* - * The ETag contains a value which represents the version of the file, in - * quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the directory was last modified. Any operation - * that modifies the share or its properties or metadata updates the last - * modified time. Operations on files do not affect the last modified time - * of the share. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header is returned so that the client can check for message content - * integrity. The value of this header is computed by the File service; it - * is not necessarily the same value as may have been specified in the - * request headers. - */ - @JsonProperty(value = "Content-MD5") - private byte[] contentMD5; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The value of this header is set to true if the contents of the request - * are successfully encrypted using the specified algorithm, and false - * otherwise. - */ - @JsonProperty(value = "x-ms-request-server-encrypted") - private Boolean isServerEncrypted; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value which represents the - * version of the file, in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value which represents the - * version of the file, in quotes. - * - * @param eTag the eTag value to set. - * @return the FileUploadRangeHeaders object itself. - */ - public FileUploadRangeHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the directory - * was last modified. Any operation that modifies the share or its - * properties or metadata updates the last modified time. Operations on - * files do not affect the last modified time of the share. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the directory - * was last modified. Any operation that modifies the share or its - * properties or metadata updates the last modified time. Operations on - * files do not affect the last modified time of the share. - * - * @param lastModified the lastModified value to set. - * @return the FileUploadRangeHeaders object itself. - */ - public FileUploadRangeHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the contentMD5 property: This header is returned so that the client - * can check for message content integrity. The value of this header is - * computed by the File service; it is not necessarily the same value as - * may have been specified in the request headers. - * - * @return the contentMD5 value. - */ - public byte[] contentMD5() { - return Arrays.copyOf(this.contentMD5, this.contentMD5.length); - } - - /** - * Set the contentMD5 property: This header is returned so that the client - * can check for message content integrity. The value of this header is - * computed by the File service; it is not necessarily the same value as - * may have been specified in the request headers. - * - * @param contentMD5 the contentMD5 value to set. - * @return the FileUploadRangeHeaders object itself. - */ - public FileUploadRangeHeaders contentMD5(byte[] contentMD5) { - this.contentMD5 = Arrays.copyOf(contentMD5, contentMD5.length); - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the FileUploadRangeHeaders object itself. - */ - public FileUploadRangeHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the FileUploadRangeHeaders object itself. - */ - public FileUploadRangeHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the FileUploadRangeHeaders object itself. - */ - public FileUploadRangeHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @return the isServerEncrypted value. - */ - public Boolean isServerEncrypted() { - return this.isServerEncrypted; - } - - /** - * Set the isServerEncrypted property: The value of this header is set to - * true if the contents of the request are successfully encrypted using the - * specified algorithm, and false otherwise. - * - * @param isServerEncrypted the isServerEncrypted value to set. - * @return the FileUploadRangeHeaders object itself. - */ - public FileUploadRangeHeaders isServerEncrypted(Boolean isServerEncrypted) { - this.isServerEncrypted = isServerEncrypted; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the FileUploadRangeHeaders object itself. - */ - public FileUploadRangeHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FilesAbortCopyResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/FilesAbortCopyResponse.java deleted file mode 100644 index c34ccb2996d08..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FilesAbortCopyResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the abortCopy operation. - */ -public final class FilesAbortCopyResponse extends ResponseBase { - /** - * Creates an instance of FilesAbortCopyResponse. - * - * @param request the request which resulted in this FilesAbortCopyResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public FilesAbortCopyResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, FileAbortCopyHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FilesAndDirectoriesListSegment.java b/storage/client/src/main/java/com/azure/storage/file/models/FilesAndDirectoriesListSegment.java deleted file mode 100644 index b5b88d30e4b70..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FilesAndDirectoriesListSegment.java +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.ArrayList; -import java.util.List; - -/** - * Abstract for entries that can be listed from Directory. - */ -@JacksonXmlRootElement(localName = "Entries") -public final class FilesAndDirectoriesListSegment { - /* - * The directoryItems property. - */ - @JsonProperty("Directory") - private List directoryItems = new ArrayList<>(); - - /* - * The fileItems property. - */ - @JsonProperty("File") - private List fileItems = new ArrayList<>(); - - /** - * Get the directoryItems property: The directoryItems property. - * - * @return the directoryItems value. - */ - public List directoryItems() { - return this.directoryItems; - } - - /** - * Set the directoryItems property: The directoryItems property. - * - * @param directoryItems the directoryItems value to set. - * @return the FilesAndDirectoriesListSegment object itself. - */ - public FilesAndDirectoriesListSegment directoryItems(List directoryItems) { - this.directoryItems = directoryItems; - return this; - } - - /** - * Get the fileItems property: The fileItems property. - * - * @return the fileItems value. - */ - public List fileItems() { - return this.fileItems; - } - - /** - * Set the fileItems property: The fileItems property. - * - * @param fileItems the fileItems value to set. - * @return the FilesAndDirectoriesListSegment object itself. - */ - public FilesAndDirectoriesListSegment fileItems(List fileItems) { - this.fileItems = fileItems; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FilesCreateResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/FilesCreateResponse.java deleted file mode 100644 index 01e483722bd16..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FilesCreateResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the create operation. - */ -public final class FilesCreateResponse extends ResponseBase { - /** - * Creates an instance of FilesCreateResponse. - * - * @param request the request which resulted in this FilesCreateResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public FilesCreateResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, FileCreateHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FilesDeleteResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/FilesDeleteResponse.java deleted file mode 100644 index cfeb40f49cac9..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FilesDeleteResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the delete operation. - */ -public final class FilesDeleteResponse extends ResponseBase { - /** - * Creates an instance of FilesDeleteResponse. - * - * @param request the request which resulted in this FilesDeleteResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public FilesDeleteResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, FileDeleteHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FilesDownloadResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/FilesDownloadResponse.java deleted file mode 100644 index b9a1d0270c152..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FilesDownloadResponse.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; -import io.netty.buffer.ByteBuf; -import java.io.Closeable; -import reactor.core.publisher.Flux; - -/** - * Contains all response data for the download operation. - */ -public final class FilesDownloadResponse extends ResponseBase> implements Closeable { - /** - * Creates an instance of FilesDownloadResponse. - * - * @param request the request which resulted in this FilesDownloadResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the content stream. - * @param headers the deserialized headers of the HTTP response. - */ - public FilesDownloadResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Flux value, FileDownloadHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the response content stream. - */ - @Override - public Flux value() { - return super.value(); - } - - /** - * Disposes of the connection associated with this stream response. - */ - @Override - public void close() { - value().subscribe(bb -> { }, t -> { }).dispose(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FilesForceCloseHandlesResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/FilesForceCloseHandlesResponse.java deleted file mode 100644 index 2d4b04103b298..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FilesForceCloseHandlesResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the forceCloseHandles operation. - */ -public final class FilesForceCloseHandlesResponse extends ResponseBase { - /** - * Creates an instance of FilesForceCloseHandlesResponse. - * - * @param request the request which resulted in this FilesForceCloseHandlesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public FilesForceCloseHandlesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, FileForceCloseHandlesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FilesGetPropertiesResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/FilesGetPropertiesResponse.java deleted file mode 100644 index 82f13783a1111..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FilesGetPropertiesResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getProperties operation. - */ -public final class FilesGetPropertiesResponse extends ResponseBase { - /** - * Creates an instance of FilesGetPropertiesResponse. - * - * @param request the request which resulted in this FilesGetPropertiesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public FilesGetPropertiesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, FileGetPropertiesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FilesGetRangeListResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/FilesGetRangeListResponse.java deleted file mode 100644 index ed71044cd06b1..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FilesGetRangeListResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; -import java.util.List; - -/** - * Contains all response data for the getRangeList operation. - */ -public final class FilesGetRangeListResponse extends ResponseBase> { - /** - * Creates an instance of FilesGetRangeListResponse. - * - * @param request the request which resulted in this FilesGetRangeListResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public FilesGetRangeListResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, List value, FileGetRangeListHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public List value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FilesListHandlesResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/FilesListHandlesResponse.java deleted file mode 100644 index 20a1d9d78e510..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FilesListHandlesResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the listHandles operation. - */ -public final class FilesListHandlesResponse extends ResponseBase { - /** - * Creates an instance of FilesListHandlesResponse. - * - * @param request the request which resulted in this FilesListHandlesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public FilesListHandlesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, ListHandlesResponse value, FileListHandlesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public ListHandlesResponse value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FilesSetHTTPHeadersResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/FilesSetHTTPHeadersResponse.java deleted file mode 100644 index c21fdbfe01994..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FilesSetHTTPHeadersResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the setHTTPHeaders operation. - */ -public final class FilesSetHTTPHeadersResponse extends ResponseBase { - /** - * Creates an instance of FilesSetHTTPHeadersResponse. - * - * @param request the request which resulted in this FilesSetHTTPHeadersResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public FilesSetHTTPHeadersResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, FileSetHTTPHeadersHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FilesSetMetadataResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/FilesSetMetadataResponse.java deleted file mode 100644 index c46035850b214..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FilesSetMetadataResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the setMetadata operation. - */ -public final class FilesSetMetadataResponse extends ResponseBase { - /** - * Creates an instance of FilesSetMetadataResponse. - * - * @param request the request which resulted in this FilesSetMetadataResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public FilesSetMetadataResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, FileSetMetadataHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FilesStartCopyResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/FilesStartCopyResponse.java deleted file mode 100644 index c19c3285eb5b4..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FilesStartCopyResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the startCopy operation. - */ -public final class FilesStartCopyResponse extends ResponseBase { - /** - * Creates an instance of FilesStartCopyResponse. - * - * @param request the request which resulted in this FilesStartCopyResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public FilesStartCopyResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, FileStartCopyHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/FilesUploadRangeResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/FilesUploadRangeResponse.java deleted file mode 100644 index 1ed359c9e70b1..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/FilesUploadRangeResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the uploadRange operation. - */ -public final class FilesUploadRangeResponse extends ResponseBase { - /** - * Creates an instance of FilesUploadRangeResponse. - * - * @param request the request which resulted in this FilesUploadRangeResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public FilesUploadRangeResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, FileUploadRangeHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/HandleItem.java b/storage/client/src/main/java/com/azure/storage/file/models/HandleItem.java deleted file mode 100644 index a6f6d360a65e9..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/HandleItem.java +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * A listed Azure Storage handle item. - */ -@JacksonXmlRootElement(localName = "Handle") -public final class HandleItem { - /* - * XSMB service handle ID - */ - @JsonProperty(value = "HandleId", required = true) - private String handleId; - - /* - * File or directory name including full path starting from share root - */ - @JsonProperty(value = "Path", required = true) - private String path; - - /* - * FileId uniquely identifies the file or directory. - */ - @JsonProperty(value = "FileId", required = true) - private String fileId; - - /* - * ParentId uniquely identifies the parent directory of the object. - */ - @JsonProperty(value = "ParentId") - private String parentId; - - /* - * SMB session ID in context of which the file handle was opened - */ - @JsonProperty(value = "SessionId", required = true) - private String sessionId; - - /* - * Client IP that opened the handle - */ - @JsonProperty(value = "ClientIp", required = true) - private String clientIp; - - /* - * Time when the session that previously opened the handle has last been - * reconnected. (UTC) - */ - @JsonProperty(value = "OpenTime", required = true) - private DateTimeRfc1123 openTime; - - /* - * Time handle was last connected to (UTC) - */ - @JsonProperty(value = "LastReconnectTime") - private DateTimeRfc1123 lastReconnectTime; - - /** - * Get the handleId property: XSMB service handle ID. - * - * @return the handleId value. - */ - public String handleId() { - return this.handleId; - } - - /** - * Set the handleId property: XSMB service handle ID. - * - * @param handleId the handleId value to set. - * @return the HandleItem object itself. - */ - public HandleItem handleId(String handleId) { - this.handleId = handleId; - return this; - } - - /** - * Get the path property: File or directory name including full path - * starting from share root. - * - * @return the path value. - */ - public String path() { - return this.path; - } - - /** - * Set the path property: File or directory name including full path - * starting from share root. - * - * @param path the path value to set. - * @return the HandleItem object itself. - */ - public HandleItem path(String path) { - this.path = path; - return this; - } - - /** - * Get the fileId property: FileId uniquely identifies the file or - * directory. - * - * @return the fileId value. - */ - public String fileId() { - return this.fileId; - } - - /** - * Set the fileId property: FileId uniquely identifies the file or - * directory. - * - * @param fileId the fileId value to set. - * @return the HandleItem object itself. - */ - public HandleItem fileId(String fileId) { - this.fileId = fileId; - return this; - } - - /** - * Get the parentId property: ParentId uniquely identifies the parent - * directory of the object. - * - * @return the parentId value. - */ - public String parentId() { - return this.parentId; - } - - /** - * Set the parentId property: ParentId uniquely identifies the parent - * directory of the object. - * - * @param parentId the parentId value to set. - * @return the HandleItem object itself. - */ - public HandleItem parentId(String parentId) { - this.parentId = parentId; - return this; - } - - /** - * Get the sessionId property: SMB session ID in context of which the file - * handle was opened. - * - * @return the sessionId value. - */ - public String sessionId() { - return this.sessionId; - } - - /** - * Set the sessionId property: SMB session ID in context of which the file - * handle was opened. - * - * @param sessionId the sessionId value to set. - * @return the HandleItem object itself. - */ - public HandleItem sessionId(String sessionId) { - this.sessionId = sessionId; - return this; - } - - /** - * Get the clientIp property: Client IP that opened the handle. - * - * @return the clientIp value. - */ - public String clientIp() { - return this.clientIp; - } - - /** - * Set the clientIp property: Client IP that opened the handle. - * - * @param clientIp the clientIp value to set. - * @return the HandleItem object itself. - */ - public HandleItem clientIp(String clientIp) { - this.clientIp = clientIp; - return this; - } - - /** - * Get the openTime property: Time when the session that previously opened - * the handle has last been reconnected. (UTC). - * - * @return the openTime value. - */ - public OffsetDateTime openTime() { - if (this.openTime == null) { - return null; - } - return this.openTime.dateTime(); - } - - /** - * Set the openTime property: Time when the session that previously opened - * the handle has last been reconnected. (UTC). - * - * @param openTime the openTime value to set. - * @return the HandleItem object itself. - */ - public HandleItem openTime(OffsetDateTime openTime) { - if (openTime == null) { - this.openTime = null; - } else { - this.openTime = new DateTimeRfc1123(openTime); - } - return this; - } - - /** - * Get the lastReconnectTime property: Time handle was last connected to - * (UTC). - * - * @return the lastReconnectTime value. - */ - public OffsetDateTime lastReconnectTime() { - if (this.lastReconnectTime == null) { - return null; - } - return this.lastReconnectTime.dateTime(); - } - - /** - * Set the lastReconnectTime property: Time handle was last connected to - * (UTC). - * - * @param lastReconnectTime the lastReconnectTime value to set. - * @return the HandleItem object itself. - */ - public HandleItem lastReconnectTime(OffsetDateTime lastReconnectTime) { - if (lastReconnectTime == null) { - this.lastReconnectTime = null; - } else { - this.lastReconnectTime = new DateTimeRfc1123(lastReconnectTime); - } - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ListFilesAndDirectoriesSegmentResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/ListFilesAndDirectoriesSegmentResponse.java deleted file mode 100644 index 1ba129b882372..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ListFilesAndDirectoriesSegmentResponse.java +++ /dev/null @@ -1,249 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * An enumeration of directories and files. - */ -@JacksonXmlRootElement(localName = "EnumerationResults") -public final class ListFilesAndDirectoriesSegmentResponse { - /* - * The serviceEndpoint property. - */ - @JacksonXmlProperty(localName = "ServiceEndpoint", isAttribute = true) - private String serviceEndpoint; - - /* - * The shareName property. - */ - @JacksonXmlProperty(localName = "ShareName", isAttribute = true) - private String shareName; - - /* - * The shareSnapshot property. - */ - @JacksonXmlProperty(localName = "ShareSnapshot", isAttribute = true) - private String shareSnapshot; - - /* - * The directoryPath property. - */ - @JacksonXmlProperty(localName = "DirectoryPath", isAttribute = true) - private String directoryPath; - - /* - * The prefix property. - */ - @JsonProperty(value = "Prefix", required = true) - private String prefix; - - /* - * The marker property. - */ - @JsonProperty(value = "Marker") - private String marker; - - /* - * The maxResults property. - */ - @JsonProperty(value = "MaxResults") - private Integer maxResults; - - /* - * The segment property. - */ - @JsonProperty(value = "Entries", required = true) - private FilesAndDirectoriesListSegment segment; - - /* - * The nextMarker property. - */ - @JsonProperty(value = "NextMarker", required = true) - private String nextMarker; - - /** - * Get the serviceEndpoint property: The serviceEndpoint property. - * - * @return the serviceEndpoint value. - */ - public String serviceEndpoint() { - return this.serviceEndpoint; - } - - /** - * Set the serviceEndpoint property: The serviceEndpoint property. - * - * @param serviceEndpoint the serviceEndpoint value to set. - * @return the ListFilesAndDirectoriesSegmentResponse object itself. - */ - public ListFilesAndDirectoriesSegmentResponse serviceEndpoint(String serviceEndpoint) { - this.serviceEndpoint = serviceEndpoint; - return this; - } - - /** - * Get the shareName property: The shareName property. - * - * @return the shareName value. - */ - public String shareName() { - return this.shareName; - } - - /** - * Set the shareName property: The shareName property. - * - * @param shareName the shareName value to set. - * @return the ListFilesAndDirectoriesSegmentResponse object itself. - */ - public ListFilesAndDirectoriesSegmentResponse shareName(String shareName) { - this.shareName = shareName; - return this; - } - - /** - * Get the shareSnapshot property: The shareSnapshot property. - * - * @return the shareSnapshot value. - */ - public String shareSnapshot() { - return this.shareSnapshot; - } - - /** - * Set the shareSnapshot property: The shareSnapshot property. - * - * @param shareSnapshot the shareSnapshot value to set. - * @return the ListFilesAndDirectoriesSegmentResponse object itself. - */ - public ListFilesAndDirectoriesSegmentResponse shareSnapshot(String shareSnapshot) { - this.shareSnapshot = shareSnapshot; - return this; - } - - /** - * Get the directoryPath property: The directoryPath property. - * - * @return the directoryPath value. - */ - public String directoryPath() { - return this.directoryPath; - } - - /** - * Set the directoryPath property: The directoryPath property. - * - * @param directoryPath the directoryPath value to set. - * @return the ListFilesAndDirectoriesSegmentResponse object itself. - */ - public ListFilesAndDirectoriesSegmentResponse directoryPath(String directoryPath) { - this.directoryPath = directoryPath; - return this; - } - - /** - * Get the prefix property: The prefix property. - * - * @return the prefix value. - */ - public String prefix() { - return this.prefix; - } - - /** - * Set the prefix property: The prefix property. - * - * @param prefix the prefix value to set. - * @return the ListFilesAndDirectoriesSegmentResponse object itself. - */ - public ListFilesAndDirectoriesSegmentResponse prefix(String prefix) { - this.prefix = prefix; - return this; - } - - /** - * Get the marker property: The marker property. - * - * @return the marker value. - */ - public String marker() { - return this.marker; - } - - /** - * Set the marker property: The marker property. - * - * @param marker the marker value to set. - * @return the ListFilesAndDirectoriesSegmentResponse object itself. - */ - public ListFilesAndDirectoriesSegmentResponse marker(String marker) { - this.marker = marker; - return this; - } - - /** - * Get the maxResults property: The maxResults property. - * - * @return the maxResults value. - */ - public Integer maxResults() { - return this.maxResults; - } - - /** - * Set the maxResults property: The maxResults property. - * - * @param maxResults the maxResults value to set. - * @return the ListFilesAndDirectoriesSegmentResponse object itself. - */ - public ListFilesAndDirectoriesSegmentResponse maxResults(Integer maxResults) { - this.maxResults = maxResults; - return this; - } - - /** - * Get the segment property: The segment property. - * - * @return the segment value. - */ - public FilesAndDirectoriesListSegment segment() { - return this.segment; - } - - /** - * Set the segment property: The segment property. - * - * @param segment the segment value to set. - * @return the ListFilesAndDirectoriesSegmentResponse object itself. - */ - public ListFilesAndDirectoriesSegmentResponse segment(FilesAndDirectoriesListSegment segment) { - this.segment = segment; - return this; - } - - /** - * Get the nextMarker property: The nextMarker property. - * - * @return the nextMarker value. - */ - public String nextMarker() { - return this.nextMarker; - } - - /** - * Set the nextMarker property: The nextMarker property. - * - * @param nextMarker the nextMarker value to set. - * @return the ListFilesAndDirectoriesSegmentResponse object itself. - */ - public ListFilesAndDirectoriesSegmentResponse nextMarker(String nextMarker) { - this.nextMarker = nextMarker; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ListHandlesResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/ListHandlesResponse.java deleted file mode 100644 index 0592fa5d4e37e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ListHandlesResponse.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.ArrayList; -import java.util.List; - -/** - * An enumeration of handles. - */ -@JacksonXmlRootElement(localName = "EnumerationResults") -public final class ListHandlesResponse { - private static final class EntriesWrapper { - @JacksonXmlProperty(localName = "Handle") - private final List items; - - @JsonCreator - private EntriesWrapper(@JacksonXmlProperty(localName = "Handle") List items) { - this.items = items; - } - } - - /* - * The handleList property. - */ - @JsonProperty(value = "Entries") - private EntriesWrapper handleList; - - /* - * The nextMarker property. - */ - @JsonProperty(value = "NextMarker", required = true) - private String nextMarker; - - /** - * Get the handleList property: The handleList property. - * - * @return the handleList value. - */ - public List handleList() { - if (this.handleList == null) { - this.handleList = new EntriesWrapper(new ArrayList()); - } - return this.handleList.items; - } - - /** - * Set the handleList property: The handleList property. - * - * @param handleList the handleList value to set. - * @return the ListHandlesResponse object itself. - */ - public ListHandlesResponse handleList(List handleList) { - this.handleList = new EntriesWrapper(handleList); - return this; - } - - /** - * Get the nextMarker property: The nextMarker property. - * - * @return the nextMarker value. - */ - public String nextMarker() { - return this.nextMarker; - } - - /** - * Set the nextMarker property: The nextMarker property. - * - * @param nextMarker the nextMarker value to set. - * @return the ListHandlesResponse object itself. - */ - public ListHandlesResponse nextMarker(String nextMarker) { - this.nextMarker = nextMarker; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ListSharesIncludeType.java b/storage/client/src/main/java/com/azure/storage/file/models/ListSharesIncludeType.java deleted file mode 100644 index 381c8539df3cb..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ListSharesIncludeType.java +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for ListSharesIncludeType. - */ -public enum ListSharesIncludeType { - /** - * Enum value snapshots. - */ - SNAPSHOTS("snapshots"), - - /** - * Enum value metadata. - */ - METADATA("metadata"); - - /** - * The actual serialized value for a ListSharesIncludeType instance. - */ - private final String value; - - ListSharesIncludeType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a ListSharesIncludeType instance. - * - * @param value the serialized value to parse. - * @return the parsed ListSharesIncludeType object, or null if unable to parse. - */ - @JsonCreator - public static ListSharesIncludeType fromString(String value) { - ListSharesIncludeType[] items = ListSharesIncludeType.values(); - for (ListSharesIncludeType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ListSharesOptions.java b/storage/client/src/main/java/com/azure/storage/file/models/ListSharesOptions.java deleted file mode 100644 index a75b4bab697f1..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ListSharesOptions.java +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file.models; - -/** - * A set of options for selecting shares from Storage File service. - * - *
    - *
  • - * Providing {@link ListSharesOptions#prefix(String) prefix} will filter selections to {@link ShareItem shares} - * that that begin with the prefix. - *
  • - *
  • - * Providing {@link ListSharesOptions#maxResults(Integer) maxResults} will limit the number of {@link ShareItem shares} - * returned in a single page. - *
  • - *
  • - * Setting {@link ListSharesOptions#includeMetadata(boolean) includeMetadata} to true will include the metadata - * of each {@link ShareItem share}, if false {@link ShareItem#metadata() metadata} for each share will be {@code null}. - *
  • - *
  • - * Setting {@link ListSharesOptions#includeSnapshots(boolean) includeSnapshots} to true will include snapshots - * of each {@link ShareItem share}, the snapshot will be included as separate items in the response and will be - * identifiable by {@link ShareItem#snapshot() snapshot} having a value. The base share will contain {@code null} - * for the snapshot. - *
  • - *
- */ -public final class ListSharesOptions { - private String prefix; - private Integer maxResults; - private boolean includeMetadata; - private boolean includeSnapshots; - - /** - * Sets the prefix that a share must match to be included in the listing. - * - * @param prefix The prefix that shares must start with to pass the filter - * @return An updated ListSharesOptions object - */ - public ListSharesOptions prefix(String prefix) { - this.prefix = prefix; - return this; - } - - /** - * @return the prefix that a share must match to be included in the listing - */ - public String prefix() { - return prefix; - } - - /** - * Sets the maximum number of shares to include in a single response. - * - * @param maxResults Maximum number of shares to include in a single response. This value must be between 1 and 5000. - * @return An updated ListSharesOptions object - */ - public ListSharesOptions maxResults(Integer maxResults) { - this.maxResults = maxResults; - return this; - } - - /** - * @return the maximum number of shares to inlcude in a single response - */ - public Integer maxResults() { - return maxResults; - } - - /** - * Sets the status of including share metadata when listing shares - * - * If listing snapshots as well this will also determine if the snapshots have their metadata included as well. - * - * @param includeMetadata Flag indicating if metadata should be including in the listing - * @return An updated ListSharesOptions object - */ - public ListSharesOptions includeMetadata(boolean includeMetadata) { - this.includeMetadata = includeMetadata; - return this; - } - - /** - * @return the status of include share metadata when listing shares - */ - public boolean includeMetadata() { - return includeMetadata; - } - - /** - * Sets the status of including share snapshots when listing shares - * - * @param includeSnapshots Flag indicating if snapshots should be included in the listing - * @return An updated ListSharesOptions object - */ - public ListSharesOptions includeSnapshots(boolean includeSnapshots) { - this.includeSnapshots = includeSnapshots; - return this; - } - - /** - * @return the status of including share snapshots when listing shares - */ - public boolean includeSnapshots() { - return includeSnapshots; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ListSharesResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/ListSharesResponse.java deleted file mode 100644 index 97a7c340f5b69..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ListSharesResponse.java +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.ArrayList; -import java.util.List; - -/** - * An enumeration of shares. - */ -@JacksonXmlRootElement(localName = "EnumerationResults") -public final class ListSharesResponse { - /* - * The serviceEndpoint property. - */ - @JacksonXmlProperty(localName = "ServiceEndpoint", isAttribute = true) - private String serviceEndpoint; - - /* - * The prefix property. - */ - @JsonProperty(value = "Prefix") - private String prefix; - - /* - * The marker property. - */ - @JsonProperty(value = "Marker") - private String marker; - - /* - * The maxResults property. - */ - @JsonProperty(value = "MaxResults") - private Integer maxResults; - - private static final class SharesWrapper { - @JacksonXmlProperty(localName = "Share") - private final List items; - - @JsonCreator - private SharesWrapper(@JacksonXmlProperty(localName = "Share") List items) { - this.items = items; - } - } - - /* - * The shareItems property. - */ - @JsonProperty(value = "Shares") - private SharesWrapper shareItems; - - /* - * The nextMarker property. - */ - @JsonProperty(value = "NextMarker", required = true) - private String nextMarker; - - /** - * Get the serviceEndpoint property: The serviceEndpoint property. - * - * @return the serviceEndpoint value. - */ - public String serviceEndpoint() { - return this.serviceEndpoint; - } - - /** - * Set the serviceEndpoint property: The serviceEndpoint property. - * - * @param serviceEndpoint the serviceEndpoint value to set. - * @return the ListSharesResponse object itself. - */ - public ListSharesResponse serviceEndpoint(String serviceEndpoint) { - this.serviceEndpoint = serviceEndpoint; - return this; - } - - /** - * Get the prefix property: The prefix property. - * - * @return the prefix value. - */ - public String prefix() { - return this.prefix; - } - - /** - * Set the prefix property: The prefix property. - * - * @param prefix the prefix value to set. - * @return the ListSharesResponse object itself. - */ - public ListSharesResponse prefix(String prefix) { - this.prefix = prefix; - return this; - } - - /** - * Get the marker property: The marker property. - * - * @return the marker value. - */ - public String marker() { - return this.marker; - } - - /** - * Set the marker property: The marker property. - * - * @param marker the marker value to set. - * @return the ListSharesResponse object itself. - */ - public ListSharesResponse marker(String marker) { - this.marker = marker; - return this; - } - - /** - * Get the maxResults property: The maxResults property. - * - * @return the maxResults value. - */ - public Integer maxResults() { - return this.maxResults; - } - - /** - * Set the maxResults property: The maxResults property. - * - * @param maxResults the maxResults value to set. - * @return the ListSharesResponse object itself. - */ - public ListSharesResponse maxResults(Integer maxResults) { - this.maxResults = maxResults; - return this; - } - - /** - * Get the shareItems property: The shareItems property. - * - * @return the shareItems value. - */ - public List shareItems() { - if (this.shareItems == null) { - this.shareItems = new SharesWrapper(new ArrayList()); - } - return this.shareItems.items; - } - - /** - * Set the shareItems property: The shareItems property. - * - * @param shareItems the shareItems value to set. - * @return the ListSharesResponse object itself. - */ - public ListSharesResponse shareItems(List shareItems) { - this.shareItems = new SharesWrapper(shareItems); - return this; - } - - /** - * Get the nextMarker property: The nextMarker property. - * - * @return the nextMarker value. - */ - public String nextMarker() { - return this.nextMarker; - } - - /** - * Set the nextMarker property: The nextMarker property. - * - * @param nextMarker the nextMarker value to set. - * @return the ListSharesResponse object itself. - */ - public ListSharesResponse nextMarker(String nextMarker) { - this.nextMarker = nextMarker; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/Metrics.java b/storage/client/src/main/java/com/azure/storage/file/models/Metrics.java deleted file mode 100644 index a6272111de5ef..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/Metrics.java +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Storage Analytics metrics for file service. - */ -@JacksonXmlRootElement(localName = "Metrics") -public final class Metrics { - /* - * The version of Storage Analytics to configure. - */ - @JsonProperty(value = "Version", required = true) - private String version; - - /* - * Indicates whether metrics are enabled for the File service. - */ - @JsonProperty(value = "Enabled", required = true) - private boolean enabled; - - /* - * Indicates whether metrics should generate summary statistics for called - * API operations. - */ - @JsonProperty(value = "IncludeAPIs") - private Boolean includeAPIs; - - /* - * The retentionPolicy property. - */ - @JsonProperty(value = "RetentionPolicy") - private RetentionPolicy retentionPolicy; - - /** - * Get the version property: The version of Storage Analytics to configure. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: The version of Storage Analytics to configure. - * - * @param version the version value to set. - * @return the Metrics object itself. - */ - public Metrics version(String version) { - this.version = version; - return this; - } - - /** - * Get the enabled property: Indicates whether metrics are enabled for the - * File service. - * - * @return the enabled value. - */ - public boolean enabled() { - return this.enabled; - } - - /** - * Set the enabled property: Indicates whether metrics are enabled for the - * File service. - * - * @param enabled the enabled value to set. - * @return the Metrics object itself. - */ - public Metrics enabled(boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Get the includeAPIs property: Indicates whether metrics should generate - * summary statistics for called API operations. - * - * @return the includeAPIs value. - */ - public Boolean includeAPIs() { - return this.includeAPIs; - } - - /** - * Set the includeAPIs property: Indicates whether metrics should generate - * summary statistics for called API operations. - * - * @param includeAPIs the includeAPIs value to set. - * @return the Metrics object itself. - */ - public Metrics includeAPIs(Boolean includeAPIs) { - this.includeAPIs = includeAPIs; - return this; - } - - /** - * Get the retentionPolicy property: The retentionPolicy property. - * - * @return the retentionPolicy value. - */ - public RetentionPolicy retentionPolicy() { - return this.retentionPolicy; - } - - /** - * Set the retentionPolicy property: The retentionPolicy property. - * - * @param retentionPolicy the retentionPolicy value to set. - * @return the Metrics object itself. - */ - public Metrics retentionPolicy(RetentionPolicy retentionPolicy) { - this.retentionPolicy = retentionPolicy; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/Range.java b/storage/client/src/main/java/com/azure/storage/file/models/Range.java deleted file mode 100644 index d097cb3af18be..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/Range.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * An Azure Storage file range. - */ -@JacksonXmlRootElement(localName = "Range") -public final class Range { - /* - * Start of the range. - */ - @JsonProperty(value = "Start", required = true) - private long start; - - /* - * End of the range. - */ - @JsonProperty(value = "End", required = true) - private long end; - - /** - * Get the start property: Start of the range. - * - * @return the start value. - */ - public long start() { - return this.start; - } - - /** - * Set the start property: Start of the range. - * - * @param start the start value to set. - * @return the Range object itself. - */ - public Range start(long start) { - this.start = start; - return this; - } - - /** - * Get the end property: End of the range. - * - * @return the end value. - */ - public long end() { - return this.end; - } - - /** - * Set the end property: End of the range. - * - * @param end the end value to set. - * @return the Range object itself. - */ - public Range end(long end) { - this.end = end; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/RetentionPolicy.java b/storage/client/src/main/java/com/azure/storage/file/models/RetentionPolicy.java deleted file mode 100644 index 9e8cb19acd17b..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/RetentionPolicy.java +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * The retention policy. - */ -@JacksonXmlRootElement(localName = "RetentionPolicy") -public final class RetentionPolicy { - /* - * Indicates whether a retention policy is enabled for the File service. If - * false, metrics data is retained, and the user is responsible for - * deleting it. - */ - @JsonProperty(value = "Enabled", required = true) - private boolean enabled; - - /* - * Indicates the number of days that metrics data should be retained. All - * data older than this value will be deleted. Metrics data is deleted on a - * best-effort basis after the retention period expires. - */ - @JsonProperty(value = "Days") - private Integer days; - - /** - * Get the enabled property: Indicates whether a retention policy is - * enabled for the File service. If false, metrics data is retained, and - * the user is responsible for deleting it. - * - * @return the enabled value. - */ - public boolean enabled() { - return this.enabled; - } - - /** - * Set the enabled property: Indicates whether a retention policy is - * enabled for the File service. If false, metrics data is retained, and - * the user is responsible for deleting it. - * - * @param enabled the enabled value to set. - * @return the RetentionPolicy object itself. - */ - public RetentionPolicy enabled(boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Get the days property: Indicates the number of days that metrics data - * should be retained. All data older than this value will be deleted. - * Metrics data is deleted on a best-effort basis after the retention - * period expires. - * - * @return the days value. - */ - public Integer days() { - return this.days; - } - - /** - * Set the days property: Indicates the number of days that metrics data - * should be retained. All data older than this value will be deleted. - * Metrics data is deleted on a best-effort basis after the retention - * period expires. - * - * @param days the days value to set. - * @return the RetentionPolicy object itself. - */ - public RetentionPolicy days(Integer days) { - this.days = days; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ServiceGetPropertiesHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/ServiceGetPropertiesHeaders.java deleted file mode 100644 index 409494366dcf8..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ServiceGetPropertiesHeaders.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Defines headers for GetProperties operation. - */ -@JacksonXmlRootElement(localName = "Service-GetProperties-Headers") -public final class ServiceGetPropertiesHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ServiceGetPropertiesHeaders object itself. - */ - public ServiceGetPropertiesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the ServiceGetPropertiesHeaders object itself. - */ - public ServiceGetPropertiesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ServiceGetPropertiesHeaders object itself. - */ - public ServiceGetPropertiesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ServiceListSharesSegmentHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/ServiceListSharesSegmentHeaders.java deleted file mode 100644 index a735f1b81589d..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ServiceListSharesSegmentHeaders.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Defines headers for ListSharesSegment operation. - */ -@JacksonXmlRootElement(localName = "Service-ListSharesSegment-Headers") -public final class ServiceListSharesSegmentHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ServiceListSharesSegmentHeaders object itself. - */ - public ServiceListSharesSegmentHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the ServiceListSharesSegmentHeaders object itself. - */ - public ServiceListSharesSegmentHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ServiceListSharesSegmentHeaders object itself. - */ - public ServiceListSharesSegmentHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ServiceSetPropertiesHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/ServiceSetPropertiesHeaders.java deleted file mode 100644 index 43ce484399730..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ServiceSetPropertiesHeaders.java +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Defines headers for SetProperties operation. - */ -@JacksonXmlRootElement(localName = "Service-SetProperties-Headers") -public final class ServiceSetPropertiesHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ServiceSetPropertiesHeaders object itself. - */ - public ServiceSetPropertiesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the ServiceSetPropertiesHeaders object itself. - */ - public ServiceSetPropertiesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ServiceSetPropertiesHeaders object itself. - */ - public ServiceSetPropertiesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ServicesGetPropertiesResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/ServicesGetPropertiesResponse.java deleted file mode 100644 index 92a15ab7d889e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ServicesGetPropertiesResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getProperties operation. - */ -public final class ServicesGetPropertiesResponse extends ResponseBase { - /** - * Creates an instance of ServicesGetPropertiesResponse. - * - * @param request the request which resulted in this ServicesGetPropertiesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ServicesGetPropertiesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, FileServiceProperties value, ServiceGetPropertiesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public FileServiceProperties value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ServicesListSharesSegmentResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/ServicesListSharesSegmentResponse.java deleted file mode 100644 index 62c1b74d4824a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ServicesListSharesSegmentResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the listSharesSegment operation. - */ -public final class ServicesListSharesSegmentResponse extends ResponseBase { - /** - * Creates an instance of ServicesListSharesSegmentResponse. - * - * @param request the request which resulted in this ServicesListSharesSegmentResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ServicesListSharesSegmentResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, ListSharesResponse value, ServiceListSharesSegmentHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public ListSharesResponse value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ServicesSetPropertiesResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/ServicesSetPropertiesResponse.java deleted file mode 100644 index db07375b93e7e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ServicesSetPropertiesResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the setProperties operation. - */ -public final class ServicesSetPropertiesResponse extends ResponseBase { - /** - * Creates an instance of ServicesSetPropertiesResponse. - * - * @param request the request which resulted in this ServicesSetPropertiesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ServicesSetPropertiesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ServiceSetPropertiesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ShareCreateHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/ShareCreateHeaders.java deleted file mode 100644 index 32ec5a693c9fc..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ShareCreateHeaders.java +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Create operation. - */ -@JacksonXmlRootElement(localName = "Share-Create-Headers") -public final class ShareCreateHeaders { - /* - * The ETag contains a value which represents the version of the share, in - * quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the share was last modified. Any operation - * that modifies the share or its properties or metadata updates the last - * modified time. Operations on files do not affect the last modified time - * of the share. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value which represents the - * version of the share, in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value which represents the - * version of the share, in quotes. - * - * @param eTag the eTag value to set. - * @return the ShareCreateHeaders object itself. - */ - public ShareCreateHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the share or its properties - * or metadata updates the last modified time. Operations on files do not - * affect the last modified time of the share. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the share or its properties - * or metadata updates the last modified time. Operations on files do not - * affect the last modified time of the share. - * - * @param lastModified the lastModified value to set. - * @return the ShareCreateHeaders object itself. - */ - public ShareCreateHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ShareCreateHeaders object itself. - */ - public ShareCreateHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the ShareCreateHeaders object itself. - */ - public ShareCreateHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ShareCreateHeaders object itself. - */ - public ShareCreateHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ShareCreateHeaders object itself. - */ - public ShareCreateHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ShareCreateSnapshotHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/ShareCreateSnapshotHeaders.java deleted file mode 100644 index 5163b958e1a2d..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ShareCreateSnapshotHeaders.java +++ /dev/null @@ -1,266 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for CreateSnapshot operation. - */ -@JacksonXmlRootElement(localName = "Share-CreateSnapshot-Headers") -public final class ShareCreateSnapshotHeaders { - /* - * This header is a DateTime value that uniquely identifies the share - * snapshot. The value of this header may be used in subsequent requests to - * access the share snapshot. This value is opaque. - */ - @JsonProperty(value = "x-ms-snapshot") - private String snapshot; - - /* - * The ETag contains a value which represents the version of the share - * snapshot, in quotes. A share snapshot cannot be modified, so the ETag of - * a given share snapshot never changes. However, if new metadata was - * supplied with the Snapshot Share request then the ETag of the share - * snapshot differs from that of the base share. If no metadata was - * specified with the request, the ETag of the share snapshot is identical - * to that of the base share at the time the share snapshot was taken. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the share was last modified. A share snapshot - * cannot be modified, so the last modified time of a given share snapshot - * never changes. However, if new metadata was supplied with the Snapshot - * Share request then the last modified time of the share snapshot differs - * from that of the base share. If no metadata was specified with the - * request, the last modified time of the share snapshot is identical to - * that of the base share at the time the share snapshot was taken. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the snapshot property: This header is a DateTime value that uniquely - * identifies the share snapshot. The value of this header may be used in - * subsequent requests to access the share snapshot. This value is opaque. - * - * @return the snapshot value. - */ - public String snapshot() { - return this.snapshot; - } - - /** - * Set the snapshot property: This header is a DateTime value that uniquely - * identifies the share snapshot. The value of this header may be used in - * subsequent requests to access the share snapshot. This value is opaque. - * - * @param snapshot the snapshot value to set. - * @return the ShareCreateSnapshotHeaders object itself. - */ - public ShareCreateSnapshotHeaders snapshot(String snapshot) { - this.snapshot = snapshot; - return this; - } - - /** - * Get the eTag property: The ETag contains a value which represents the - * version of the share snapshot, in quotes. A share snapshot cannot be - * modified, so the ETag of a given share snapshot never changes. However, - * if new metadata was supplied with the Snapshot Share request then the - * ETag of the share snapshot differs from that of the base share. If no - * metadata was specified with the request, the ETag of the share snapshot - * is identical to that of the base share at the time the share snapshot - * was taken. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value which represents the - * version of the share snapshot, in quotes. A share snapshot cannot be - * modified, so the ETag of a given share snapshot never changes. However, - * if new metadata was supplied with the Snapshot Share request then the - * ETag of the share snapshot differs from that of the base share. If no - * metadata was specified with the request, the ETag of the share snapshot - * is identical to that of the base share at the time the share snapshot - * was taken. - * - * @param eTag the eTag value to set. - * @return the ShareCreateSnapshotHeaders object itself. - */ - public ShareCreateSnapshotHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the share was - * last modified. A share snapshot cannot be modified, so the last modified - * time of a given share snapshot never changes. However, if new metadata - * was supplied with the Snapshot Share request then the last modified time - * of the share snapshot differs from that of the base share. If no - * metadata was specified with the request, the last modified time of the - * share snapshot is identical to that of the base share at the time the - * share snapshot was taken. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the share was - * last modified. A share snapshot cannot be modified, so the last modified - * time of a given share snapshot never changes. However, if new metadata - * was supplied with the Snapshot Share request then the last modified time - * of the share snapshot differs from that of the base share. If no - * metadata was specified with the request, the last modified time of the - * share snapshot is identical to that of the base share at the time the - * share snapshot was taken. - * - * @param lastModified the lastModified value to set. - * @return the ShareCreateSnapshotHeaders object itself. - */ - public ShareCreateSnapshotHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ShareCreateSnapshotHeaders object itself. - */ - public ShareCreateSnapshotHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the ShareCreateSnapshotHeaders object itself. - */ - public ShareCreateSnapshotHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ShareCreateSnapshotHeaders object itself. - */ - public ShareCreateSnapshotHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ShareCreateSnapshotHeaders object itself. - */ - public ShareCreateSnapshotHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ShareDeleteHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/ShareDeleteHeaders.java deleted file mode 100644 index ce8c796eba7c6..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ShareDeleteHeaders.java +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Delete operation. - */ -@JacksonXmlRootElement(localName = "Share-Delete-Headers") -public final class ShareDeleteHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ShareDeleteHeaders object itself. - */ - public ShareDeleteHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the ShareDeleteHeaders object itself. - */ - public ShareDeleteHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ShareDeleteHeaders object itself. - */ - public ShareDeleteHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ShareDeleteHeaders object itself. - */ - public ShareDeleteHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ShareGetAccessPolicyHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/ShareGetAccessPolicyHeaders.java deleted file mode 100644 index 9988562a78509..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ShareGetAccessPolicyHeaders.java +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for GetAccessPolicy operation. - */ -@JacksonXmlRootElement(localName = "Share-GetAccessPolicy-Headers") -public final class ShareGetAccessPolicyHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally, in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the share was last modified. Any operation - * that modifies the share or its properties updates the last modified - * time. Operations on files do not affect the last modified time of the - * share. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @param eTag the eTag value to set. - * @return the ShareGetAccessPolicyHeaders object itself. - */ - public ShareGetAccessPolicyHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the share or its properties - * updates the last modified time. Operations on files do not affect the - * last modified time of the share. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the share or its properties - * updates the last modified time. Operations on files do not affect the - * last modified time of the share. - * - * @param lastModified the lastModified value to set. - * @return the ShareGetAccessPolicyHeaders object itself. - */ - public ShareGetAccessPolicyHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ShareGetAccessPolicyHeaders object itself. - */ - public ShareGetAccessPolicyHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the ShareGetAccessPolicyHeaders object itself. - */ - public ShareGetAccessPolicyHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ShareGetAccessPolicyHeaders object itself. - */ - public ShareGetAccessPolicyHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ShareGetAccessPolicyHeaders object itself. - */ - public ShareGetAccessPolicyHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ShareGetPropertiesHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/ShareGetPropertiesHeaders.java deleted file mode 100644 index c9534dc5060b2..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ShareGetPropertiesHeaders.java +++ /dev/null @@ -1,260 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.annotations.HeaderCollection; -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; -import java.util.Map; - -/** - * Defines headers for GetProperties operation. - */ -@JacksonXmlRootElement(localName = "Share-GetProperties-Headers") -public final class ShareGetPropertiesHeaders { - /* - * The metadata property. - */ - @HeaderCollection("x-ms-meta-") - private Map metadata; - - /* - * The ETag contains a value that you can use to perform operations - * conditionally, in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the share was last modified. Any operation - * that modifies the share or its properties updates the last modified - * time. Operations on files do not affect the last modified time of the - * share. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * Returns the current share quota in GB. - */ - @JsonProperty(value = "x-ms-share-quota") - private Integer quota; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the metadata property: The metadata property. - * - * @return the metadata value. - */ - public Map metadata() { - return this.metadata; - } - - /** - * Set the metadata property: The metadata property. - * - * @param metadata the metadata value to set. - * @return the ShareGetPropertiesHeaders object itself. - */ - public ShareGetPropertiesHeaders metadata(Map metadata) { - this.metadata = metadata; - return this; - } - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @param eTag the eTag value to set. - * @return the ShareGetPropertiesHeaders object itself. - */ - public ShareGetPropertiesHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the share or its properties - * updates the last modified time. Operations on files do not affect the - * last modified time of the share. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the share or its properties - * updates the last modified time. Operations on files do not affect the - * last modified time of the share. - * - * @param lastModified the lastModified value to set. - * @return the ShareGetPropertiesHeaders object itself. - */ - public ShareGetPropertiesHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ShareGetPropertiesHeaders object itself. - */ - public ShareGetPropertiesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the ShareGetPropertiesHeaders object itself. - */ - public ShareGetPropertiesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ShareGetPropertiesHeaders object itself. - */ - public ShareGetPropertiesHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the quota property: Returns the current share quota in GB. - * - * @return the quota value. - */ - public Integer quota() { - return this.quota; - } - - /** - * Set the quota property: Returns the current share quota in GB. - * - * @param quota the quota value to set. - * @return the ShareGetPropertiesHeaders object itself. - */ - public ShareGetPropertiesHeaders quota(Integer quota) { - this.quota = quota; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ShareGetPropertiesHeaders object itself. - */ - public ShareGetPropertiesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ShareGetStatisticsHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/ShareGetStatisticsHeaders.java deleted file mode 100644 index 575cafb0351a9..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ShareGetStatisticsHeaders.java +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for GetStatistics operation. - */ -@JacksonXmlRootElement(localName = "Share-GetStatistics-Headers") -public final class ShareGetStatisticsHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally, in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the share was last modified. Any operation - * that modifies the share or its properties updates the last modified - * time. Operations on files do not affect the last modified time of the - * share. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @param eTag the eTag value to set. - * @return the ShareGetStatisticsHeaders object itself. - */ - public ShareGetStatisticsHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the share or its properties - * updates the last modified time. Operations on files do not affect the - * last modified time of the share. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the share or its properties - * updates the last modified time. Operations on files do not affect the - * last modified time of the share. - * - * @param lastModified the lastModified value to set. - * @return the ShareGetStatisticsHeaders object itself. - */ - public ShareGetStatisticsHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ShareGetStatisticsHeaders object itself. - */ - public ShareGetStatisticsHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the ShareGetStatisticsHeaders object itself. - */ - public ShareGetStatisticsHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ShareGetStatisticsHeaders object itself. - */ - public ShareGetStatisticsHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ShareGetStatisticsHeaders object itself. - */ - public ShareGetStatisticsHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ShareInfo.java b/storage/client/src/main/java/com/azure/storage/file/models/ShareInfo.java deleted file mode 100644 index 5961516ce950b..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ShareInfo.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file.models; - -import java.time.OffsetDateTime; - -/** - * Contains information about a Share in the storage File service. - */ -public final class ShareInfo { - private final String eTag; - private final OffsetDateTime lastModified; - - /** - * Creates an instance of information about a specific Share. - * - * @param eTag Entity tag that corresponds to the share - * @param lastModified Last time the share was modified - */ - public ShareInfo(String eTag, OffsetDateTime lastModified) { - this.eTag = eTag; - this.lastModified = lastModified; - } - - /** - * @return the entity tag that corresponds to the share - */ - public String eTag() { - return eTag; - } - - /** - * @return the last time the share was modified - */ - public OffsetDateTime lastModified() { - return lastModified; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ShareItem.java b/storage/client/src/main/java/com/azure/storage/file/models/ShareItem.java deleted file mode 100644 index 23a64ac334548..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ShareItem.java +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.Map; - -/** - * A listed Azure Storage share item. - */ -@JacksonXmlRootElement(localName = "Share") -public final class ShareItem { - /* - * The name property. - */ - @JsonProperty(value = "Name", required = true) - private String name; - - /* - * The snapshot property. - */ - @JsonProperty(value = "Snapshot") - private String snapshot; - - /* - * The properties property. - */ - @JsonProperty(value = "Properties", required = true) - private ShareProperties properties; - - /* - * The metadata property. - */ - @JsonProperty(value = "Metadata") - private Map metadata; - - /** - * Get the name property: The name property. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: The name property. - * - * @param name the name value to set. - * @return the ShareItem object itself. - */ - public ShareItem name(String name) { - this.name = name; - return this; - } - - /** - * Get the snapshot property: The snapshot property. - * - * @return the snapshot value. - */ - public String snapshot() { - return this.snapshot; - } - - /** - * Set the snapshot property: The snapshot property. - * - * @param snapshot the snapshot value to set. - * @return the ShareItem object itself. - */ - public ShareItem snapshot(String snapshot) { - this.snapshot = snapshot; - return this; - } - - /** - * Get the properties property: The properties property. - * - * @return the properties value. - */ - public ShareProperties properties() { - return this.properties; - } - - /** - * Set the properties property: The properties property. - * - * @param properties the properties value to set. - * @return the ShareItem object itself. - */ - public ShareItem properties(ShareProperties properties) { - this.properties = properties; - return this; - } - - /** - * Get the metadata property: The metadata property. - * - * @return the metadata value. - */ - public Map metadata() { - return this.metadata; - } - - /** - * Set the metadata property: The metadata property. - * - * @param metadata the metadata value to set. - * @return the ShareItem object itself. - */ - public ShareItem metadata(Map metadata) { - this.metadata = metadata; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ShareProperties.java b/storage/client/src/main/java/com/azure/storage/file/models/ShareProperties.java deleted file mode 100644 index 62da0bfbe4faf..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ShareProperties.java +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.annotations.HeaderCollection; -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import java.time.OffsetDateTime; -import java.util.Map; - -/** - * Properties of a share. - */ -@JacksonXmlRootElement(localName = "ShareProperties") -public final class ShareProperties { - /* - * The lastModified property. - */ - @JsonProperty(value = "Last-Modified", required = true) - private DateTimeRfc1123 lastModified; - - /* - * The etag property. - */ - @JsonProperty(value = "Etag", required = true) - private String etag; - - /* - * The quota property. - */ - @JsonProperty(value = "Quota", required = true) - private int quota; - - @HeaderCollection(value = "x-ms-meta-") - private Map metadata; - - /** - * Get the lastModified property: The lastModified property. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: The lastModified property. - * - * @param lastModified the lastModified value to set. - * @return the ShareProperties object itself. - */ - public ShareProperties lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the etag property: The etag property. - * - * @return the etag value. - */ - public String etag() { - return this.etag; - } - - /** - * Set the etag property: The etag property. - * - * @param etag the etag value to set. - * @return the ShareProperties object itself. - */ - public ShareProperties etag(String etag) { - this.etag = etag; - return this; - } - - /** - * Get the quota property: The quota property. - * - * @return the quota value. - */ - public int quota() { - return this.quota; - } - - /** - * Set the quota property: The quota property. - * - * @param quota the quota value to set. - * @return the ShareProperties object itself. - */ - public ShareProperties quota(int quota) { - this.quota = quota; - return this; - } - - public Map metadata() { - return metadata; - } - - public ShareProperties metadata(Map metadata) { - this.metadata = metadata; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ShareSetAccessPolicyHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/ShareSetAccessPolicyHeaders.java deleted file mode 100644 index 4a688b1d61e4d..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ShareSetAccessPolicyHeaders.java +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for SetAccessPolicy operation. - */ -@JacksonXmlRootElement(localName = "Share-SetAccessPolicy-Headers") -public final class ShareSetAccessPolicyHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally, in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the share was last modified. Any operation - * that modifies the share or its properties updates the last modified - * time. Operations on files do not affect the last modified time of the - * share. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @param eTag the eTag value to set. - * @return the ShareSetAccessPolicyHeaders object itself. - */ - public ShareSetAccessPolicyHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the share or its properties - * updates the last modified time. Operations on files do not affect the - * last modified time of the share. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the share or its properties - * updates the last modified time. Operations on files do not affect the - * last modified time of the share. - * - * @param lastModified the lastModified value to set. - * @return the ShareSetAccessPolicyHeaders object itself. - */ - public ShareSetAccessPolicyHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ShareSetAccessPolicyHeaders object itself. - */ - public ShareSetAccessPolicyHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the ShareSetAccessPolicyHeaders object itself. - */ - public ShareSetAccessPolicyHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ShareSetAccessPolicyHeaders object itself. - */ - public ShareSetAccessPolicyHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ShareSetAccessPolicyHeaders object itself. - */ - public ShareSetAccessPolicyHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ShareSetMetadataHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/ShareSetMetadataHeaders.java deleted file mode 100644 index f92662e355a14..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ShareSetMetadataHeaders.java +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for SetMetadata operation. - */ -@JacksonXmlRootElement(localName = "Share-SetMetadata-Headers") -public final class ShareSetMetadataHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally, in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the share was last modified. Any operation - * that modifies the share or its properties updates the last modified - * time. Operations on files do not affect the last modified time of the - * share. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @param eTag the eTag value to set. - * @return the ShareSetMetadataHeaders object itself. - */ - public ShareSetMetadataHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the share or its properties - * updates the last modified time. Operations on files do not affect the - * last modified time of the share. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the share or its properties - * updates the last modified time. Operations on files do not affect the - * last modified time of the share. - * - * @param lastModified the lastModified value to set. - * @return the ShareSetMetadataHeaders object itself. - */ - public ShareSetMetadataHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ShareSetMetadataHeaders object itself. - */ - public ShareSetMetadataHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the ShareSetMetadataHeaders object itself. - */ - public ShareSetMetadataHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ShareSetMetadataHeaders object itself. - */ - public ShareSetMetadataHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ShareSetMetadataHeaders object itself. - */ - public ShareSetMetadataHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ShareSetQuotaHeaders.java b/storage/client/src/main/java/com/azure/storage/file/models/ShareSetQuotaHeaders.java deleted file mode 100644 index 819b1046c923b..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ShareSetQuotaHeaders.java +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for SetQuota operation. - */ -@JacksonXmlRootElement(localName = "Share-SetQuota-Headers") -public final class ShareSetQuotaHeaders { - /* - * The ETag contains a value that you can use to perform operations - * conditionally, in quotes. - */ - @JsonProperty(value = "ETag") - private String eTag; - - /* - * Returns the date and time the share was last modified. Any operation - * that modifies the share or its properties updates the last modified - * time. Operations on files do not affect the last modified time of the - * share. - */ - @JsonProperty(value = "Last-Modified") - private DateTimeRfc1123 lastModified; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the File service used to execute the request. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * A UTC date/time value generated by the service that indicates the time - * at which the response was initiated. - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @return the eTag value. - */ - public String eTag() { - return this.eTag; - } - - /** - * Set the eTag property: The ETag contains a value that you can use to - * perform operations conditionally, in quotes. - * - * @param eTag the eTag value to set. - * @return the ShareSetQuotaHeaders object itself. - */ - public ShareSetQuotaHeaders eTag(String eTag) { - this.eTag = eTag; - return this; - } - - /** - * Get the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the share or its properties - * updates the last modified time. Operations on files do not affect the - * last modified time of the share. - * - * @return the lastModified value. - */ - public OffsetDateTime lastModified() { - if (this.lastModified == null) { - return null; - } - return this.lastModified.dateTime(); - } - - /** - * Set the lastModified property: Returns the date and time the share was - * last modified. Any operation that modifies the share or its properties - * updates the last modified time. Operations on files do not affect the - * last modified time of the share. - * - * @param lastModified the lastModified value to set. - * @return the ShareSetQuotaHeaders object itself. - */ - public ShareSetQuotaHeaders lastModified(OffsetDateTime lastModified) { - if (lastModified == null) { - this.lastModified = null; - } else { - this.lastModified = new DateTimeRfc1123(lastModified); - } - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ShareSetQuotaHeaders object itself. - */ - public ShareSetQuotaHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the File service used - * to execute the request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the File service used - * to execute the request. - * - * @param version the version value to set. - * @return the ShareSetQuotaHeaders object itself. - */ - public ShareSetQuotaHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: A UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ShareSetQuotaHeaders object itself. - */ - public ShareSetQuotaHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ShareSetQuotaHeaders object itself. - */ - public ShareSetQuotaHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ShareSnapshotInfo.java b/storage/client/src/main/java/com/azure/storage/file/models/ShareSnapshotInfo.java deleted file mode 100644 index 4e95b45182a23..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ShareSnapshotInfo.java +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file.models; - -import java.time.OffsetDateTime; - -/** - * Contains information about a snapshot of a Share in the storage File service. - */ -public final class ShareSnapshotInfo { - private String snapshot; - private String eTag; - private OffsetDateTime lastModified; - - /** - * Creates an instance of snapshot information for a specific Share. - * - * @param snapshot Identifier for the snapshot - * @param eTag Entity tag that corresponds to the snapshot - * @param lastModified Last time the Share was modified if the snapshot was created without metadata, if the snapshot - * was created with metadata then it will be the time the snapshot was created - */ - public ShareSnapshotInfo(String snapshot, String eTag, OffsetDateTime lastModified) { - this.snapshot = snapshot; - this.eTag = eTag; - this.lastModified = lastModified; - } - - /** - * @return the identifier of the snapshot - */ - public String snapshot() { - return snapshot; - } - - /** - * @return the entity tag that corresponds to the snapshot - */ - public String eTag() { - return eTag; - } - - /** - * @return the last time the share was modified if the snapshot was created without metadata, otherwise this is the - * time that the snapshot was created. - */ - public OffsetDateTime lastModified() { - return lastModified; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ShareStatistics.java b/storage/client/src/main/java/com/azure/storage/file/models/ShareStatistics.java deleted file mode 100644 index d10648dfb3dc8..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ShareStatistics.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.storage.file.models; - -/** - * Contains statistics about a Share in the storage File service. - */ -public final class ShareStatistics { - private final int shareUsageInGB; - - /** - * Creates an instance of storage statistics for a Share. - * - * @param shareUsageInGB Size in GB of the Share - */ - public ShareStatistics(int shareUsageInGB) { - this.shareUsageInGB = shareUsageInGB; - } - - /** - * @return the size in GB of the Share - */ - public int getShareUsageInGB() { - return shareUsageInGB; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/ShareStats.java b/storage/client/src/main/java/com/azure/storage/file/models/ShareStats.java deleted file mode 100644 index 6738332eb4709..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/ShareStats.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Stats for the share. - */ -@JacksonXmlRootElement(localName = "ShareStats") -public final class ShareStats { - /* - * The approximate size of the data stored in bytes, rounded up to the - * nearest gigabyte. Note that this value may not include all recently - * created or recently resized files. - */ - @JsonProperty(value = "ShareUsageBytes", required = true) - private int shareUsageBytes; - - /** - * Get the shareUsageBytes property: The approximate size of the data - * stored in bytes, rounded up to the nearest gigabyte. Note that this - * value may not include all recently created or recently resized files. - * - * @return the shareUsageBytes value. - */ - public int shareUsageBytes() { - return this.shareUsageBytes; - } - - /** - * Set the shareUsageBytes property: The approximate size of the data - * stored in bytes, rounded up to the nearest gigabyte. Note that this - * value may not include all recently created or recently resized files. - * - * @param shareUsageBytes the shareUsageBytes value to set. - * @return the ShareStats object itself. - */ - public ShareStats shareUsageBytes(int shareUsageBytes) { - this.shareUsageBytes = shareUsageBytes; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/SharesCreateResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/SharesCreateResponse.java deleted file mode 100644 index 240af8232a16d..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/SharesCreateResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the create operation. - */ -public final class SharesCreateResponse extends ResponseBase { - /** - * Creates an instance of SharesCreateResponse. - * - * @param request the request which resulted in this SharesCreateResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public SharesCreateResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ShareCreateHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/SharesCreateSnapshotResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/SharesCreateSnapshotResponse.java deleted file mode 100644 index b9f9d375c2803..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/SharesCreateSnapshotResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the createSnapshot operation. - */ -public final class SharesCreateSnapshotResponse extends ResponseBase { - /** - * Creates an instance of SharesCreateSnapshotResponse. - * - * @param request the request which resulted in this SharesCreateSnapshotResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public SharesCreateSnapshotResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ShareCreateSnapshotHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/SharesDeleteResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/SharesDeleteResponse.java deleted file mode 100644 index 9477ce4c7e8b8..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/SharesDeleteResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the delete operation. - */ -public final class SharesDeleteResponse extends ResponseBase { - /** - * Creates an instance of SharesDeleteResponse. - * - * @param request the request which resulted in this SharesDeleteResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public SharesDeleteResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ShareDeleteHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/SharesGetAccessPolicyResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/SharesGetAccessPolicyResponse.java deleted file mode 100644 index a48f3b3b30834..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/SharesGetAccessPolicyResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; -import java.util.List; - -/** - * Contains all response data for the getAccessPolicy operation. - */ -public final class SharesGetAccessPolicyResponse extends ResponseBase> { - /** - * Creates an instance of SharesGetAccessPolicyResponse. - * - * @param request the request which resulted in this SharesGetAccessPolicyResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public SharesGetAccessPolicyResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, List value, ShareGetAccessPolicyHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public List value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/SharesGetPropertiesResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/SharesGetPropertiesResponse.java deleted file mode 100644 index 9716a989187a0..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/SharesGetPropertiesResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getProperties operation. - */ -public final class SharesGetPropertiesResponse extends ResponseBase { - /** - * Creates an instance of SharesGetPropertiesResponse. - * - * @param request the request which resulted in this SharesGetPropertiesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public SharesGetPropertiesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ShareGetPropertiesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/SharesGetStatisticsResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/SharesGetStatisticsResponse.java deleted file mode 100644 index ff9d976a06066..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/SharesGetStatisticsResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getStatistics operation. - */ -public final class SharesGetStatisticsResponse extends ResponseBase { - /** - * Creates an instance of SharesGetStatisticsResponse. - * - * @param request the request which resulted in this SharesGetStatisticsResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public SharesGetStatisticsResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, ShareStats value, ShareGetStatisticsHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public ShareStats value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/SharesSetAccessPolicyResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/SharesSetAccessPolicyResponse.java deleted file mode 100644 index e510ad67fc75c..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/SharesSetAccessPolicyResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the setAccessPolicy operation. - */ -public final class SharesSetAccessPolicyResponse extends ResponseBase { - /** - * Creates an instance of SharesSetAccessPolicyResponse. - * - * @param request the request which resulted in this SharesSetAccessPolicyResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public SharesSetAccessPolicyResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ShareSetAccessPolicyHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/SharesSetMetadataResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/SharesSetMetadataResponse.java deleted file mode 100644 index ee0c5437446a7..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/SharesSetMetadataResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the setMetadata operation. - */ -public final class SharesSetMetadataResponse extends ResponseBase { - /** - * Creates an instance of SharesSetMetadataResponse. - * - * @param request the request which resulted in this SharesSetMetadataResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public SharesSetMetadataResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ShareSetMetadataHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/SharesSetQuotaResponse.java b/storage/client/src/main/java/com/azure/storage/file/models/SharesSetQuotaResponse.java deleted file mode 100644 index af406592123d5..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/SharesSetQuotaResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the setQuota operation. - */ -public final class SharesSetQuotaResponse extends ResponseBase { - /** - * Creates an instance of SharesSetQuotaResponse. - * - * @param request the request which resulted in this SharesSetQuotaResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public SharesSetQuotaResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ShareSetQuotaHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/SignedIdentifier.java b/storage/client/src/main/java/com/azure/storage/file/models/SignedIdentifier.java deleted file mode 100644 index 566ab7070c713..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/SignedIdentifier.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Signed identifier. - */ -@JacksonXmlRootElement(localName = "SignedIdentifier") -public final class SignedIdentifier { - /* - * A unique id. - */ - @JsonProperty(value = "Id", required = true) - private String id; - - /* - * The access policy. - */ - @JsonProperty(value = "AccessPolicy") - private AccessPolicy accessPolicy; - - /** - * Get the id property: A unique id. - * - * @return the id value. - */ - public String id() { - return this.id; - } - - /** - * Set the id property: A unique id. - * - * @param id the id value to set. - * @return the SignedIdentifier object itself. - */ - public SignedIdentifier id(String id) { - this.id = id; - return this; - } - - /** - * Get the accessPolicy property: The access policy. - * - * @return the accessPolicy value. - */ - public AccessPolicy accessPolicy() { - return this.accessPolicy; - } - - /** - * Set the accessPolicy property: The access policy. - * - * @param accessPolicy the accessPolicy value to set. - * @return the SignedIdentifier object itself. - */ - public SignedIdentifier accessPolicy(AccessPolicy accessPolicy) { - this.accessPolicy = accessPolicy; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/StorageError.java b/storage/client/src/main/java/com/azure/storage/file/models/StorageError.java deleted file mode 100644 index 801db72d87c0a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/StorageError.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * The StorageError model. - */ -@JacksonXmlRootElement(localName = "StorageError") -public final class StorageError { - /* - * The message property. - */ - @JsonProperty(value = "Message") - private String message; - - /** - * Get the message property: The message property. - * - * @return the message value. - */ - public String message() { - return this.message; - } - - /** - * Set the message property: The message property. - * - * @param message the message value to set. - * @return the StorageError object itself. - */ - public StorageError message(String message) { - this.message = message; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/StorageErrorCode.java b/storage/client/src/main/java/com/azure/storage/file/models/StorageErrorCode.java deleted file mode 100644 index 682ff493c1918..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/StorageErrorCode.java +++ /dev/null @@ -1,332 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** - * Defines values for StorageErrorCode. - */ -public final class StorageErrorCode extends ExpandableStringEnum { - /** - * Static value AccountAlreadyExists for StorageErrorCode. - */ - public static final StorageErrorCode ACCOUNT_ALREADY_EXISTS = fromString("AccountAlreadyExists"); - - /** - * Static value AccountBeingCreated for StorageErrorCode. - */ - public static final StorageErrorCode ACCOUNT_BEING_CREATED = fromString("AccountBeingCreated"); - - /** - * Static value AccountIsDisabled for StorageErrorCode. - */ - public static final StorageErrorCode ACCOUNT_IS_DISABLED = fromString("AccountIsDisabled"); - - /** - * Static value AuthenticationFailed for StorageErrorCode. - */ - public static final StorageErrorCode AUTHENTICATION_FAILED = fromString("AuthenticationFailed"); - - /** - * Static value AuthorizationFailure for StorageErrorCode. - */ - public static final StorageErrorCode AUTHORIZATION_FAILURE = fromString("AuthorizationFailure"); - - /** - * Static value ConditionHeadersNotSupported for StorageErrorCode. - */ - public static final StorageErrorCode CONDITION_HEADERS_NOT_SUPPORTED = fromString("ConditionHeadersNotSupported"); - - /** - * Static value ConditionNotMet for StorageErrorCode. - */ - public static final StorageErrorCode CONDITION_NOT_MET = fromString("ConditionNotMet"); - - /** - * Static value EmptyMetadataKey for StorageErrorCode. - */ - public static final StorageErrorCode EMPTY_METADATA_KEY = fromString("EmptyMetadataKey"); - - /** - * Static value InsufficientAccountPermissions for StorageErrorCode. - */ - public static final StorageErrorCode INSUFFICIENT_ACCOUNT_PERMISSIONS = fromString("InsufficientAccountPermissions"); - - /** - * Static value InternalError for StorageErrorCode. - */ - public static final StorageErrorCode INTERNAL_ERROR = fromString("InternalError"); - - /** - * Static value InvalidAuthenticationInfo for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_AUTHENTICATION_INFO = fromString("InvalidAuthenticationInfo"); - - /** - * Static value InvalidHeaderValue for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_HEADER_VALUE = fromString("InvalidHeaderValue"); - - /** - * Static value InvalidHttpVerb for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_HTTP_VERB = fromString("InvalidHttpVerb"); - - /** - * Static value InvalidInput for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_INPUT = fromString("InvalidInput"); - - /** - * Static value InvalidMd5 for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_MD5 = fromString("InvalidMd5"); - - /** - * Static value InvalidMetadata for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_METADATA = fromString("InvalidMetadata"); - - /** - * Static value InvalidQueryParameterValue for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_QUERY_PARAMETER_VALUE = fromString("InvalidQueryParameterValue"); - - /** - * Static value InvalidRange for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_RANGE = fromString("InvalidRange"); - - /** - * Static value InvalidResourceName for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_RESOURCE_NAME = fromString("InvalidResourceName"); - - /** - * Static value InvalidUri for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_URI = fromString("InvalidUri"); - - /** - * Static value InvalidXmlDocument for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_XML_DOCUMENT = fromString("InvalidXmlDocument"); - - /** - * Static value InvalidXmlNodeValue for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_XML_NODE_VALUE = fromString("InvalidXmlNodeValue"); - - /** - * Static value Md5Mismatch for StorageErrorCode. - */ - public static final StorageErrorCode MD5MISMATCH = fromString("Md5Mismatch"); - - /** - * Static value MetadataTooLarge for StorageErrorCode. - */ - public static final StorageErrorCode METADATA_TOO_LARGE = fromString("MetadataTooLarge"); - - /** - * Static value MissingContentLengthHeader for StorageErrorCode. - */ - public static final StorageErrorCode MISSING_CONTENT_LENGTH_HEADER = fromString("MissingContentLengthHeader"); - - /** - * Static value MissingRequiredQueryParameter for StorageErrorCode. - */ - public static final StorageErrorCode MISSING_REQUIRED_QUERY_PARAMETER = fromString("MissingRequiredQueryParameter"); - - /** - * Static value MissingRequiredHeader for StorageErrorCode. - */ - public static final StorageErrorCode MISSING_REQUIRED_HEADER = fromString("MissingRequiredHeader"); - - /** - * Static value MissingRequiredXmlNode for StorageErrorCode. - */ - public static final StorageErrorCode MISSING_REQUIRED_XML_NODE = fromString("MissingRequiredXmlNode"); - - /** - * Static value MultipleConditionHeadersNotSupported for StorageErrorCode. - */ - public static final StorageErrorCode MULTIPLE_CONDITION_HEADERS_NOT_SUPPORTED = fromString("MultipleConditionHeadersNotSupported"); - - /** - * Static value OperationTimedOut for StorageErrorCode. - */ - public static final StorageErrorCode OPERATION_TIMED_OUT = fromString("OperationTimedOut"); - - /** - * Static value OutOfRangeInput for StorageErrorCode. - */ - public static final StorageErrorCode OUT_OF_RANGE_INPUT = fromString("OutOfRangeInput"); - - /** - * Static value OutOfRangeQueryParameterValue for StorageErrorCode. - */ - public static final StorageErrorCode OUT_OF_RANGE_QUERY_PARAMETER_VALUE = fromString("OutOfRangeQueryParameterValue"); - - /** - * Static value RequestBodyTooLarge for StorageErrorCode. - */ - public static final StorageErrorCode REQUEST_BODY_TOO_LARGE = fromString("RequestBodyTooLarge"); - - /** - * Static value ResourceTypeMismatch for StorageErrorCode. - */ - public static final StorageErrorCode RESOURCE_TYPE_MISMATCH = fromString("ResourceTypeMismatch"); - - /** - * Static value RequestUrlFailedToParse for StorageErrorCode. - */ - public static final StorageErrorCode REQUEST_URL_FAILED_TO_PARSE = fromString("RequestUrlFailedToParse"); - - /** - * Static value ResourceAlreadyExists for StorageErrorCode. - */ - public static final StorageErrorCode RESOURCE_ALREADY_EXISTS = fromString("ResourceAlreadyExists"); - - /** - * Static value ResourceNotFound for StorageErrorCode. - */ - public static final StorageErrorCode RESOURCE_NOT_FOUND = fromString("ResourceNotFound"); - - /** - * Static value ServerBusy for StorageErrorCode. - */ - public static final StorageErrorCode SERVER_BUSY = fromString("ServerBusy"); - - /** - * Static value UnsupportedHeader for StorageErrorCode. - */ - public static final StorageErrorCode UNSUPPORTED_HEADER = fromString("UnsupportedHeader"); - - /** - * Static value UnsupportedXmlNode for StorageErrorCode. - */ - public static final StorageErrorCode UNSUPPORTED_XML_NODE = fromString("UnsupportedXmlNode"); - - /** - * Static value UnsupportedQueryParameter for StorageErrorCode. - */ - public static final StorageErrorCode UNSUPPORTED_QUERY_PARAMETER = fromString("UnsupportedQueryParameter"); - - /** - * Static value UnsupportedHttpVerb for StorageErrorCode. - */ - public static final StorageErrorCode UNSUPPORTED_HTTP_VERB = fromString("UnsupportedHttpVerb"); - - /** - * Static value CannotDeleteFileOrDirectory for StorageErrorCode. - */ - public static final StorageErrorCode CANNOT_DELETE_FILE_OR_DIRECTORY = fromString("CannotDeleteFileOrDirectory"); - - /** - * Static value ClientCacheFlushDelay for StorageErrorCode. - */ - public static final StorageErrorCode CLIENT_CACHE_FLUSH_DELAY = fromString("ClientCacheFlushDelay"); - - /** - * Static value DeletePending for StorageErrorCode. - */ - public static final StorageErrorCode DELETE_PENDING = fromString("DeletePending"); - - /** - * Static value DirectoryNotEmpty for StorageErrorCode. - */ - public static final StorageErrorCode DIRECTORY_NOT_EMPTY = fromString("DirectoryNotEmpty"); - - /** - * Static value FileLockConflict for StorageErrorCode. - */ - public static final StorageErrorCode FILE_LOCK_CONFLICT = fromString("FileLockConflict"); - - /** - * Static value InvalidFileOrDirectoryPathName for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_FILE_OR_DIRECTORY_PATH_NAME = fromString("InvalidFileOrDirectoryPathName"); - - /** - * Static value ParentNotFound for StorageErrorCode. - */ - public static final StorageErrorCode PARENT_NOT_FOUND = fromString("ParentNotFound"); - - /** - * Static value ReadOnlyAttribute for StorageErrorCode. - */ - public static final StorageErrorCode READ_ONLY_ATTRIBUTE = fromString("ReadOnlyAttribute"); - - /** - * Static value ShareAlreadyExists for StorageErrorCode. - */ - public static final StorageErrorCode SHARE_ALREADY_EXISTS = fromString("ShareAlreadyExists"); - - /** - * Static value ShareBeingDeleted for StorageErrorCode. - */ - public static final StorageErrorCode SHARE_BEING_DELETED = fromString("ShareBeingDeleted"); - - /** - * Static value ShareDisabled for StorageErrorCode. - */ - public static final StorageErrorCode SHARE_DISABLED = fromString("ShareDisabled"); - - /** - * Static value ShareNotFound for StorageErrorCode. - */ - public static final StorageErrorCode SHARE_NOT_FOUND = fromString("ShareNotFound"); - - /** - * Static value SharingViolation for StorageErrorCode. - */ - public static final StorageErrorCode SHARING_VIOLATION = fromString("SharingViolation"); - - /** - * Static value ShareSnapshotInProgress for StorageErrorCode. - */ - public static final StorageErrorCode SHARE_SNAPSHOT_IN_PROGRESS = fromString("ShareSnapshotInProgress"); - - /** - * Static value ShareSnapshotCountExceeded for StorageErrorCode. - */ - public static final StorageErrorCode SHARE_SNAPSHOT_COUNT_EXCEEDED = fromString("ShareSnapshotCountExceeded"); - - /** - * Static value ShareSnapshotOperationNotSupported for StorageErrorCode. - */ - public static final StorageErrorCode SHARE_SNAPSHOT_OPERATION_NOT_SUPPORTED = fromString("ShareSnapshotOperationNotSupported"); - - /** - * Static value ShareHasSnapshots for StorageErrorCode. - */ - public static final StorageErrorCode SHARE_HAS_SNAPSHOTS = fromString("ShareHasSnapshots"); - - /** - * Static value ContainerQuotaDowngradeNotAllowed for StorageErrorCode. - */ - public static final StorageErrorCode CONTAINER_QUOTA_DOWNGRADE_NOT_ALLOWED = fromString("ContainerQuotaDowngradeNotAllowed"); - - /** - * Creates or finds a StorageErrorCode from its string representation. - * - * @param name a name to look for. - * @return the corresponding StorageErrorCode. - */ - @JsonCreator - public static StorageErrorCode fromString(String name) { - return fromString(name, StorageErrorCode.class); - } - - /** - * @return known StorageErrorCode values. - */ - public static Collection values() { - return values(StorageErrorCode.class); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/StorageErrorException.java b/storage/client/src/main/java/com/azure/storage/file/models/StorageErrorException.java deleted file mode 100644 index 76a6def9161fd..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/StorageErrorException.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.file.models; - -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.HttpResponse; - -/** - * Exception thrown for an invalid response with StorageError information. - */ -public final class StorageErrorException extends HttpResponseException { - /** - * Initializes a new instance of the StorageErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - */ - public StorageErrorException(String message, HttpResponse response) { - super(message, response); - } - - /** - * Initializes a new instance of the StorageErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - * @param value the deserialized response value. - */ - public StorageErrorException(String message, HttpResponse response, StorageError value) { - super(message, response, value); - } - - @Override - public StorageError value() { - return (StorageError) super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/file/models/package-info.java b/storage/client/src/main/java/com/azure/storage/file/models/package-info.java deleted file mode 100644 index b21cb828d0f54..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/file/models/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -/** - * This package contains the data models for AzureFileStorage. - */ -package com.azure.storage.file.models; diff --git a/storage/client/src/main/java/com/azure/storage/queue/QueueAsyncClient.java b/storage/client/src/main/java/com/azure/storage/queue/QueueAsyncClient.java deleted file mode 100644 index 0b3cc59af7fd2..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/QueueAsyncClient.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.azure.storage.queue; - -import com.azure.core.ServiceClient; -import com.azure.core.http.HttpPipeline; -import com.azure.storage.queue.implementation.AzureQueueStorageImpl; - -import java.net.URL; - -public class QueueAsyncClient extends ServiceClient { - private final String endpoint; - private final AzureQueueStorageImpl generateClient; - private final String apiVersion; - - private QueueAsyncClient(URL endpoint, HttpPipeline httpPipeline) { - super(httpPipeline); - this.endpoint = endpoint.toString(); - this.generateClient = new AzureQueueStorageImpl(httpPipeline).withUrl(this.endpoint); - this.apiVersion = this.generateClient.version(); - } - - /** - * Creates a builder that can configure options for the SecretAsyncClient before creating an instance of it. - * @return A new builder to create a SecretAsyncClient from. - */ - public static QueueAsyncClientBuilder builder() { - return new QueueAsyncClientBuilder(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/QueueAsyncClientBuilder.java b/storage/client/src/main/java/com/azure/storage/queue/QueueAsyncClientBuilder.java deleted file mode 100644 index b76c9c63e8700..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/QueueAsyncClientBuilder.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.azure.storage.queue; - -public class QueueAsyncClientBuilder { - -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/README.md b/storage/client/src/main/java/com/azure/storage/queue/README.md deleted file mode 100644 index a8868770168e7..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/README.md +++ /dev/null @@ -1,377 +0,0 @@ -# Azure Storage Queue client library for Java -Azure Queue storage is a service for storing large numbers of messages that can be accessed from anywhere in the world via authenticated calls using HTTP or HTTPS. -A single queue message can be up to 64 KB in size, and a queue can contain millions of messages, up to the total capacity limit of a storage account. - -[Source code][source_code] | [Package (Maven)][package] | [API reference documentation][api_documentation] | [Product documentation][storage_docs] - -## Getting started - -### Prerequisites - -- [Java Development Kit (JDK)][jdk] with version 8 or above -- [Azure Subscription][azure_subscription] -- [Create Strorage Account][storage_account] - -### Adding the package to your product - -```xml - - com.azure - azure-storage - 12.0.0 - -``` - -### Create a Storage Account -To create a Storage Account you can use the Azure Portal or [Azure CLI][azure_cli]. - -```Powershell -az group create \ - --name storage-resource-group \ - --location westus -``` - -### Authenticate the client - -In order to interact with the Storage service (Blob, Queue, Message, MessageId, File) you'll need to create an instance of the Service Client class. -To make this possible you'll need the Account SAS (shared access signature) string of Storage account. Learn more at [SAS Token][sas_token] - -#### Get Credentials - -- **SAS Token** - -a. Use the [Azure CLI][azure_cli] snippet below to get the SAS token from the Storage account. - -```Powershell -az storage queue generate-sas - --name {queue name} - --expiry {date/time to expire SAS token} - --permission {permission to grant} - --connection-string {connection string of the storage account} -``` - -```Powershell -CONNECTION_STRING= -az storage queue generate-sas - --name javasdksas - --expiry 2019-06-05 - --permission rpau - --connection-string $CONNECTION_STRING -``` -b. Alternatively, get the Account SAS Token from the Azure Portal. -``` -Go to your storage account -> Shared access signature -> Click on Generate SAS and connection string -``` - -- **Shared Key Credential** - -a. Use account name and account key. Account name is your storage account name. -``` -// Here is where we get the key -Go to your storage account -> Access keys -> Key 1/ Key 2 -> Key -``` -b. Use the connection string -``` -// Here is where we get the key -Go to your storage account -> Access Keys -> Keys 1/ Key 2 -> Connection string -``` -## Key concepts -### URL format -Queues are addressable using the following URL format: -https://.queue.core.windows.net/ -The following URL addresses a queue in the diagram: -https://myaccount.queue.core.windows.net/images-to-download - -#### Resource URI Syntax -For the storage account, the base URI for queue operations includes the name of the account only: -```$xslt -https://myaccount.queue.core.windows.net -``` -For a queue, the base URI includes the name of the account and the name of the queue: -```$xslt -https://myaccount.queue.core.windows.net/myqueue -``` - -### Handling Exceptions - -```java -TODO -``` - -### Queue Names -Every queue within an account must have a unique name. The queue name must be a valid DNS name, and cannot be changed once created. Queue names must confirm to the following rules: -1. A queue name must start with a letter or number, and can only contain letters, numbers, and the dash (-) character. -1. The first and last letters in the queue name must be alphanumeric. The dash (-) character cannot be the first or last character. Consecutive dash characters are not permitted in the queue name. -1. All letters in a queue name must be lowercase. -1. A queue name must be from 3 through 63 characters long. - -### Queue Services -The queue service do operations on the queues in the storage account and manage the queue properties. - -### Queue Service Client - -The client performs the interactions with the Queue service, create or delete a queue, getting and setting Queue properties, list queues in account, and get queue statistics. An asynchronous, `QueueServiceAsyncClient`, and synchronous, `QueueClient`, client exists in the SDK allowing for selection of a client based on an application's use case. -Once you have the value of the SASToken you can create the queue service client with `${accountName}`, `${sasToken}`. -```Java -String queueServiceURL = String.format("https://%s.queue.core.windows.net/%s", accountName, sasToken) -QueueServiceClient queueServiceClient = QueueServiceClient.builder().endpoint(queueURL).build(); - -QueueClient newQueueServiceClient = queueServiceClient.createQueue("myqueue"); -``` - -or - -```Java -String queueServiceAsyncURL = String.format("https://%s.queue.core.windows.net/%s", accountName, sasToken) -QueueServiceAsyncClient queueServiceAsyncClient = QueueServiceAsyncClient.builder().endpoint(queueServiceAsyncURL).build(); -queueServiceAsyncClient.createQueue("newAsyncQueue").subscribe( - result -> { - // do something when new queue created - }, - error -> { - // do something if something wrong happened - }, - () -> { - // completed, do something - }); -``` - -### Queue -Azure Queue storage is a service for storing large numbers of messages that can be accessed from anywhere in the world via authenticated calls using HTTP or HTTPS. -A single queue message can be up to 64 KB in size, and a queue can contain millions of messages, up to the total capacity limit of a storage account. - -### QueueClient -Once you have the value of the SASToken you can create the queue service client with `${accountName}`, `${queueName}`, `${sasToken}`. -```Java -String queueURL = String.format("https://%s.queue.core.windows.net/%s%s", accountName, queueName, sasToken); -QueueClient queueClient = QueueClient.builder().endpoint(queueURL).build(); -// metadata is map of key-value pair, timeout is client side timeout -QueueClient newQueueClient = queueClient.create(metadata, timeout); -``` - -or - -```Java -String queueAsyncURL = String.format("https://%s.queue.core.windows.net/%s%s", accountName, queueAsyncName, sasToken) -QueueAsyncClient queueAsyncClient = QueueAsyncClient.builder().endpoint(queueAsyncURL).build(); -queueAsyncClient.create(metadata, timeout).subscribe( - result -> { - // do something when new queue created - }, - error -> { - // do something if something wrong happened - }, - () -> { - // completed, do something - }); -``` - -## Examples - -The following sections provide several code snippets covering some of the most common Configuration Service tasks, including: -- [Create a Queue](#Create-a-queue) -- [Delete a queue](#Delete-a-queue) -- [List the queues in account](#List-queues-in-account) -- [Get propertiesin Queue account](#Get-properties-in-queue-account) -- [Set propertiesin Queue account](#Set-properties-in-queue-account) -- [Get statistcs of queue](#Get-queue-service-statistics) -- [Enqueue message into a queue](#Enqueue-message-into-a-queue) -- [Update message into a queue](#Update-message-into-a-queue) -- [Peek messages into a queue](#Peek-messages-into-a-queue) -- [Dequeue messages from a queue](#Dequeue-messages-from-a-queue) -- [Delete message from a queue](#Delete-message-from-a-queue) -- [Get a Queue properties](#Get-a-queue-properties) -- [Set a queue metada](#set-a-queue-metadata) - -### Create a queue - -Create a queue in the Storage Account. Throws StorageErrorException If the queue fails to be created. - -```Java -String queueServiceURL = String.format("https://%s.queue.core.windows.net/%s", accountName, sasToken) -QueueServiceClient queueServiceClient = QueueServiceClient.builder().endpoint(queueURL).build(); - -QueueClient newQueueServiceClient = queueServiceClient.createQueue("myqueue"); -``` -### Delete a queue - -Delete a queue in the Storage Account. Throws StorageErrorException If the queue fails to be deleted. -```Java -String queueServiceURL = String.format("https://%s.queue.core.windows.net/%s", accountName, sasToken) -QueueServiceClient queueServiceClient = QueueServiceClient.builder().endpoint(queueURL).build(); - -QueueClient newQueueServiceClient = queueServiceClient.deleteQueue("myqueue"); -``` - -### List queues in account - -List all the queues in account. -```Java -String queueServiceURL = String.format("https://%s.queue.core.windows.net/%s", accountName, sasToken) -QueueServiceClient queueServiceClient = QueueServiceClient.builder().endpoint(queueURL).build(); -// @param marker: Starting point to list the queues -// @param options: Filter for queue selection -queueServiceClient.listQueuesSegment(marker, options).forEach{ - queueItem -> {//do something} -}; -``` - -### Get properties in queue account - -Get queue properties in account, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. -```Java -String queueServiceURL = String.format("https://%s.queue.core.windows.net/%s", accountName, sasToken) -QueueServiceClient queueServiceClient = QueueServiceClient.builder().endpoint(queueURL).build(); - -Response properties = queueServiceClient.getProperties(); -``` - -### Set properties in queue account - -Set queue properties in account, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. -```Java -String queueServiceURL = String.format("https://%s.queue.core.windows.net/%s", accountName, sasToken) -QueueServiceClient queueServiceClient = QueueServiceClient.builder().endpoint(queueURL).build(); - -StorageServiceProperties properties = new StorageServiceProperties() { - // logging: some logging; - // HourMetrics: some metrics - // MinuteMetrics: some metrics - // Cors: some cors -} - -queueServiceClient.setProperties(properties); -``` - -### Get queue service statistics -he `Get Queue Service Stats` operation retrieves statistics related to replication for the Queue service. -It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account. -```Java -String queueServiceURL = String.format("https://%s.queue.core.windows.net/%s", accountName, sasToken) -QueueServiceClient queueServiceClient = QueueServiceClient.builder().endpoint(queueURL).build(); - -Response queueStats = queueServiceClient.getStatistics(); -``` - -### Enqueue message into a queue -The operation adds a new message to the back of the message queue. A visibility timeout can also be specified to make the message invisible until the visibility timeout expires. -A message must be in a format that can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for versions 2011-08-18 and newer, or 8 KB in size for previous versions. -```Java -String queueURL = String.format("https://%s.queue.core.windows.net/%s%s", accountName, queueName, sasToken); -QueueClient queueClient = QueueClient.builder().endpoint(queueURL).build(); - -queueClient.enqueueMessage("myMessage"); -``` - -### Update messaged from a queue -The operation updates a message in the message queue. -```Java -String queueURL = String.format("https://%s.queue.core.windows.net/%s%s", accountName, queueName, sasToken); -QueueClient queueClient = QueueClient.builder().endpoint(queueURL).build(); -// @param messageId Id of the message -// @param popReceipt Unique identifier that must match the message for it to be updated -// @param visibilityTimeout How long the message will be invisible in the queue in seconds -queueClient.updateMessage(messageId, "new message", popReceipt, visibilityTimeout); -``` - -### Peek messages from a queue -The operation retrieves one or more messages from the front of the queue. -```Java -String queueURL = String.format("https://%s.queue.core.windows.net/%s%s", accountName, queueName, sasToken); -QueueClient queueClient = QueueClient.builder().endpoint(queueURL).build(); - -queueClient.peekMessages().forEach(message-> {print message.messageText();}); -``` - - -### Dequeue messages from a queue -The operation retrieves one or more messages from the front of the queue. -```Java -String queueURL = String.format("https://%s.queue.core.windows.net/%s%s", accountName, queueName, sasToken); -QueueClient queueClient = QueueClient.builder().endpoint(queueURL).build(); - -queueClient.dequeueMessage("myMessage").forEach(message-> {print message.messageText();}); -``` - - -### Delete message from a queue -The operation retrieves one or more messages from the front of the queue. -```Java -String queueURL = String.format("https://%s.queue.core.windows.net/%s%s", accountName, queueName, sasToken); -QueueClient queueClient = QueueClient.builder().endpoint(queueURL).build(); - -queueClient.deleteMessage(messageId, popReceipt); -``` - -### Get a queue properties -The operation retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the queue as name-values pairs. -```Java -String queueURL = String.format("https://%s.queue.core.windows.net/%s%s", accountName, queueName, sasToken); -QueueClient queueClient = QueueClient.builder().endpoint(queueURL).build(); - -Response properties = queueClient.getProperties(); -``` - -### Set a queue metadata -The operation sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. -```Java -String queueURL = String.format("https://%s.queue.core.windows.net/%s%s", accountName, queueName, sasToken); -QueueClient queueClient = QueueClient.builder().endpoint(queueURL).build(); - -Map metadata = new HashMap<>() {{ - put("key1", "val1"); - put("key2", "val2"); -}}; -queueClient.setMetadata(metadata); -``` - - -## Troubleshooting - -## General - -When you interact with queue using this Java client library, errors returned by the service correspond to the same HTTP status codes returned for [REST API][storage_rest] requests. For example, if you try to retrieve a queue that doesn't exist in your Storage Account, a `404` error is returned, indicating `Not Found`. - -## Next steps - -### More Samples -- QueueServiceSample -- MessageSample -- QueueExceptionSample -- AsyncSample - -[Quickstart: Create a Java Spring app with App Configuration](https://docs.microsoft.com/en-us/azure/azure-app-configuration/quickstart-java-spring-app) - -## Contributing -This project welcomes contributions and suggestions. Most contributions require you to agree to a -Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us -the rights to use your contribution. For details, visit https://cla.microsoft.com. - -When you submit a pull request, a CLA-bot will automatically determine whether you need to provide -a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions -provided by the bot. You will only need to do this once across all repos using our CLA. - -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). -For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or -contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. - -If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft Azure Projects Contribution Guidelines](http://azure.github.io/guidelines.html). - -1. Fork it -2. Create your feature branch (`git checkout -b my-new-feature`) -3. Commit your changes (`git commit -am 'Add some feature'`) -4. Push to the branch (`git push origin my-new-feature`) -5. Create new Pull Request - - -[source_code]: to-be-continue -[package]: to-be-continue -[api_documentation]: https://docs.microsoft.com/en-us/rest/api/storageservices/queue-service-rest-api -[storage_docs]: https://docs.microsoft.com/en-us/azure/storage/queues/storage-queues-introduction -[jdk]: https://docs.microsoft.com/en-us/java/azure/java-supported-jdk-runtime?view=azure-java-stable -[maven]: https://maven.apache.org/ -[azure_subscription]: https://azure.microsoft.com/en-us/free/ -[storage_account]: https://docs.microsoft.com/en-us/azure/storage/common/storage-quickstart-create-account?tabs=azure-portal -[azure_cli]: https://docs.microsoft.com/cli/azure -[sas_token]: https://docs.microsoft.com/en-us/azure/storage/common/storage-dotnet-shared-access-signature-part-1 -[storage_rest]: https://docs.microsoft.com/en-us/rest/api/storageservices/queue-service-error-codes diff --git a/storage/client/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java b/storage/client/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java deleted file mode 100644 index 354ba1b5e2a0e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/implementation/AzureQueueStorageImpl.java +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation; - -import com.azure.core.ServiceClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.implementation.RestProxy; - -/** - * Initializes a new instance of the AzureQueueStorage type. - */ -public final class AzureQueueStorageImpl extends ServiceClient { - /** - * The URL of the service account, queue or message that is the targe of the desired operation. - */ - private String url; - - /** - * Gets The URL of the service account, queue or message that is the targe of the desired operation. - * - * @return the url value. - */ - public String url() { - return this.url; - } - - /** - * Sets The URL of the service account, queue or message that is the targe of the desired operation. - * - * @param url the url value. - * @return the service client itself. - */ - public AzureQueueStorageImpl withUrl(String url) { - this.url = url; - return this; - } - - /** - * Specifies the version of the operation to use for this request. - */ - private String version; - - /** - * Gets Specifies the version of the operation to use for this request. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Sets Specifies the version of the operation to use for this request. - * - * @param version the version value. - * @return the service client itself. - */ - public AzureQueueStorageImpl withVersion(String version) { - this.version = version; - return this; - } - - /** - * The ServicesImpl object to access its operations. - */ - private ServicesImpl services; - - /** - * Gets the ServicesImpl object to access its operations. - * - * @return the ServicesImpl object. - */ - public ServicesImpl services() { - return this.services; - } - - /** - * The QueuesImpl object to access its operations. - */ - private QueuesImpl queues; - - /** - * Gets the QueuesImpl object to access its operations. - * - * @return the QueuesImpl object. - */ - public QueuesImpl queues() { - return this.queues; - } - - /** - * The MessagesImpl object to access its operations. - */ - private MessagesImpl messages; - - /** - * Gets the MessagesImpl object to access its operations. - * - * @return the MessagesImpl object. - */ - public MessagesImpl messages() { - return this.messages; - } - - /** - * The MessageIdsImpl object to access its operations. - */ - private MessageIdsImpl messageIds; - - /** - * Gets the MessageIdsImpl object to access its operations. - * - * @return the MessageIdsImpl object. - */ - public MessageIdsImpl messageIds() { - return this.messageIds; - } - - /** - * Initializes an instance of AzureQueueStorage client. - */ - public AzureQueueStorageImpl() { - this(RestProxy.createDefaultPipeline()); - } - - /** - * Initializes an instance of AzureQueueStorage client. - * - * @param httpPipeline The HTTP pipeline to send requests through. - */ - public AzureQueueStorageImpl(HttpPipeline httpPipeline) { - super(httpPipeline); - this.version = "2018-03-28"; - this.services = new ServicesImpl(this); - this.queues = new QueuesImpl(this); - this.messages = new MessagesImpl(this); - this.messageIds = new MessageIdsImpl(this); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/implementation/ListQueuesIncludeTypeWrapper.java b/storage/client/src/main/java/com/azure/storage/queue/implementation/ListQueuesIncludeTypeWrapper.java deleted file mode 100644 index 661e1de266a2d..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/implementation/ListQueuesIncludeTypeWrapper.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation; - -import com.azure.storage.queue.models.ListQueuesIncludeType; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.List; - -/** - * A wrapper around List<ListQueuesIncludeType> which provides top-level metadata for serialization. - */ -@JacksonXmlRootElement(localName = "ListQueuesIncludeType") -public final class ListQueuesIncludeTypeWrapper { - @JacksonXmlProperty(localName = "ListQueuesIncludeType") - private final List listQueuesIncludeType; - - /** - * Creates an instance of ListQueuesIncludeTypeWrapper. - * - * @param listQueuesIncludeType the list. - */ - @JsonCreator - public ListQueuesIncludeTypeWrapper(@JsonProperty("ListQueuesIncludeType") List listQueuesIncludeType) { - this.listQueuesIncludeType = listQueuesIncludeType; - } - - /** - * Get the List<ListQueuesIncludeType> contained in this wrapper. - * - * @return the List<ListQueuesIncludeType>. - */ - public List items() { - return listQueuesIncludeType; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java b/storage/client/src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java deleted file mode 100644 index 8a705fe7e4af7..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/implementation/MessageIdsImpl.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation; - -import com.azure.core.annotations.BodyParam; -import com.azure.core.annotations.DELETE; -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.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; -import com.azure.core.implementation.RestProxy; -import com.azure.core.util.Context; -import com.azure.storage.queue.models.MessageIdsDeleteResponse; -import com.azure.storage.queue.models.MessageIdsUpdateResponse; -import com.azure.storage.queue.models.QueueMessage; -import com.azure.storage.queue.models.StorageErrorException; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in - * MessageIds. - */ -public final class MessageIdsImpl { - /** - * The proxy service used to perform REST calls. - */ - private MessageIdsService service; - - /** - * The service client containing this operation class. - */ - private AzureQueueStorageImpl client; - - /** - * Initializes an instance of MessageIdsImpl. - * - * @param client the instance of the service client containing this operation class. - */ - public MessageIdsImpl(AzureQueueStorageImpl client) { - this.service = RestProxy.create(MessageIdsService.class, client); - this.client = client; - } - - /** - * The interface defining all the services for MessageIds to be used by the - * proxy service to perform REST calls. - */ - @Host("{url}") - @Service("Storage Queues MessageId") - private interface MessageIdsService { - @PUT("{queueName}/messages/{messageid}") - @ExpectedResponses({204}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono update(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") QueueMessage queueMessage, @QueryParam("popreceipt") String popReceipt, @QueryParam("visibilitytimeout") int visibilitytimeout, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); - - @DELETE("{queueName}/messages/{messageid}") - @ExpectedResponses({204}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono delete(@HostParam("url") String url, @QueryParam("popreceipt") String popReceipt, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); - } - - /** - * The Update operation was introduced with version 2011-08-18 of the Queue service API. The Update Message operation updates the visibility timeout of a message. You can also use this operation to update the contents of a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the encoded message can be up to 64KB in size. - * - * @param queueMessage A Message object which can be stored in a Queue. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get Messages or Update Message operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility timeout of a message can be set to a value later than the expiry time. - * @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. - */ - public Mono updateWithRestResponseAsync(QueueMessage queueMessage, String popReceipt, int visibilitytimeout, Context context) { - final Integer timeout = null; - final String requestId = null; - return service.update(this.client.url(), queueMessage, popReceipt, visibilitytimeout, timeout, this.client.version(), requestId, context); - } - - /** - * The Update operation was introduced with version 2011-08-18 of the Queue service API. The Update Message operation updates the visibility timeout of a message. You can also use this operation to update the contents of a message. A message must be in a format that can be included in an XML request with UTF-8 encoding, and the encoded message can be up to 64KB in size. - * - * @param queueMessage A Message object which can be stored in a Queue. - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get Messages or Update Message operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. - * @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. - */ - public Mono updateWithRestResponseAsync(QueueMessage queueMessage, String popReceipt, int visibilitytimeout, Integer timeout, String requestId, Context context) { - return service.update(this.client.url(), queueMessage, popReceipt, visibilitytimeout, timeout, this.client.version(), requestId, context); - } - - /** - * The Delete operation deletes the specified message. - * - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get Messages or Update Message operation. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @return a Mono which performs the network request upon subscription. - */ - public Mono deleteWithRestResponseAsync(String popReceipt, Context context) { - final Integer timeout = null; - final String requestId = null; - return service.delete(this.client.url(), popReceipt, timeout, this.client.version(), requestId, context); - } - - /** - * The Delete operation deletes the specified message. - * - * @param popReceipt Required. Specifies the valid pop receipt value returned from an earlier call to the Get Messages or Update Message operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. - * @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. - */ - public Mono deleteWithRestResponseAsync(String popReceipt, Integer timeout, String requestId, Context context) { - return service.delete(this.client.url(), popReceipt, timeout, this.client.version(), requestId, context); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java b/storage/client/src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java deleted file mode 100644 index ee59aae16b63f..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/implementation/MessagesImpl.java +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.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.POST; -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.util.Context; -import com.azure.storage.queue.models.MessagesClearResponse; -import com.azure.storage.queue.models.MessagesDequeueResponse; -import com.azure.storage.queue.models.MessagesEnqueueResponse; -import com.azure.storage.queue.models.MessagesPeekResponse; -import com.azure.storage.queue.models.QueueMessage; -import com.azure.storage.queue.models.StorageErrorException; -import reactor.core.publisher.Mono; - -/** - * An instance of this class provides access to all the operations defined in - * Messages. - */ -public final class MessagesImpl { - /** - * The proxy service used to perform REST calls. - */ - private MessagesService service; - - /** - * The service client containing this operation class. - */ - private AzureQueueStorageImpl client; - - /** - * Initializes an instance of MessagesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - public MessagesImpl(AzureQueueStorageImpl client) { - this.service = RestProxy.create(MessagesService.class, client); - this.client = client; - } - - /** - * The interface defining all the services for Messages to be used by the - * proxy service to perform REST calls. - */ - @Host("{url}") - @Service("Storage Queues Messages") - private interface MessagesService { - @GET("{queueName}/messages") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono dequeue(@HostParam("url") String url, @QueryParam("numofmessages") Integer numberOfMessages, @QueryParam("visibilitytimeout") Integer visibilitytimeout, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); - - @DELETE("{queueName}/messages") - @ExpectedResponses({204}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono clear(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); - - @POST("{queueName}/messages") - @ExpectedResponses({201}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono enqueue(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") QueueMessage queueMessage, @QueryParam("visibilitytimeout") Integer visibilitytimeout, @QueryParam("messagettl") Integer messageTimeToLive, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); - - @GET("{queueName}/messages") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono peek(@HostParam("url") String url, @QueryParam("numofmessages") Integer numberOfMessages, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("peekonly") String peekonly, Context context); - } - - /** - * The Dequeue operation retrieves one or more messages from the front of the queue. - * - * @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. - */ - public Mono dequeueWithRestResponseAsync(Context context) { - final Integer numberOfMessages = null; - final Integer visibilitytimeout = null; - final Integer timeout = null; - final String requestId = null; - return service.dequeue(this.client.url(), numberOfMessages, visibilitytimeout, timeout, this.client.version(), requestId, context); - } - - /** - * The Dequeue operation retrieves one or more messages from the front of the queue. - * - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single message is retrieved from the queue with this operation. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility timeout of a message can be set to a value later than the expiry time. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. - * @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. - */ - public Mono dequeueWithRestResponseAsync(Integer numberOfMessages, Integer visibilitytimeout, Integer timeout, String requestId, Context context) { - return service.dequeue(this.client.url(), numberOfMessages, visibilitytimeout, timeout, this.client.version(), requestId, context); - } - - /** - * The Clear operation deletes all messages from the specified queue. - * - * @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. - */ - public Mono clearWithRestResponseAsync(Context context) { - final Integer timeout = null; - final String requestId = null; - return service.clear(this.client.url(), timeout, this.client.version(), requestId, context); - } - - /** - * The Clear operation deletes all messages from the specified queue. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. - * @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. - */ - public Mono clearWithRestResponseAsync(Integer timeout, String requestId, Context context) { - return service.clear(this.client.url(), timeout, this.client.version(), requestId, context); - } - - /** - * The Enqueue operation adds a new message to the back of the message queue. A visibility timeout can also be specified to make the message invisible until the visibility timeout expires. A message must be in a format that can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * - * @param queueMessage A Message object which can be stored in a Queue. - * @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. - */ - public Mono enqueueWithRestResponseAsync(QueueMessage queueMessage, Context context) { - final Integer visibilitytimeout = null; - final Integer messageTimeToLive = null; - final Integer timeout = null; - final String requestId = null; - return service.enqueue(this.client.url(), queueMessage, visibilitytimeout, messageTimeToLive, timeout, this.client.version(), requestId, context); - } - - /** - * The Enqueue operation adds a new message to the back of the message queue. A visibility timeout can also be specified to make the message invisible until the visibility timeout expires. A message must be in a format that can be included in an XML request with UTF-8 encoding. The encoded message can be up to 64 KB in size for versions 2011-08-18 and newer, or 8 KB in size for previous versions. - * - * @param queueMessage A Message object which can be stored in a Queue. - * @param visibilitytimeout Optional. Specifies the new visibility timeout value, in seconds, relative to server time. The default value is 30 seconds. A specified value must be larger than or equal to 1 second, and cannot be larger than 7 days, or larger than 2 hours on REST protocol versions prior to version 2011-08-18. The visibility timeout of a message can be set to a value later than the expiry time. - * @param messageTimeToLive Optional. Specifies the time-to-live interval for the message, in seconds. Prior to version 2017-07-29, the maximum time-to-live allowed is 7 days. For version 2017-07-29 or later, the maximum time-to-live can be any positive number, as well as -1 indicating that the message does not expire. If this parameter is omitted, the default time-to-live is 7 days. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. - * @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. - */ - public Mono enqueueWithRestResponseAsync(QueueMessage queueMessage, Integer visibilitytimeout, Integer messageTimeToLive, Integer timeout, String requestId, Context context) { - return service.enqueue(this.client.url(), queueMessage, visibilitytimeout, messageTimeToLive, timeout, this.client.version(), requestId, context); - } - - /** - * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility of the message. - * - * @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. - */ - public Mono peekWithRestResponseAsync(Context context) { - final Integer numberOfMessages = null; - final Integer timeout = null; - final String requestId = null; - final String peekonly = "true"; - return service.peek(this.client.url(), numberOfMessages, timeout, this.client.version(), requestId, peekonly, context); - } - - /** - * The Peek operation retrieves one or more messages from the front of the queue, but does not alter the visibility of the message. - * - * @param numberOfMessages Optional. A nonzero integer value that specifies the number of messages to retrieve from the queue, up to a maximum of 32. If fewer are visible, the visible messages are returned. By default, a single message is retrieved from the queue with this operation. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. - * @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. - */ - public Mono peekWithRestResponseAsync(Integer numberOfMessages, Integer timeout, String requestId, Context context) { - final String peekonly = "true"; - return service.peek(this.client.url(), numberOfMessages, timeout, this.client.version(), requestId, peekonly, context); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java b/storage/client/src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java deleted file mode 100644 index 2eb2d4d1ec2e2..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/implementation/QueuesImpl.java +++ /dev/null @@ -1,266 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.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.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; -import com.azure.core.implementation.RestProxy; -import com.azure.core.util.Context; -import com.azure.storage.queue.models.QueuesCreateResponse; -import com.azure.storage.queue.models.QueuesDeleteResponse; -import com.azure.storage.queue.models.QueuesGetAccessPolicyResponse; -import com.azure.storage.queue.models.QueuesGetPropertiesResponse; -import com.azure.storage.queue.models.QueuesSetAccessPolicyResponse; -import com.azure.storage.queue.models.QueuesSetMetadataResponse; -import com.azure.storage.queue.models.SignedIdentifier; -import com.azure.storage.queue.models.StorageErrorException; -import reactor.core.publisher.Mono; - -import java.util.List; -import java.util.Map; - -/** - * An instance of this class provides access to all the operations defined in - * Queues. - */ -public final class QueuesImpl { - /** - * The proxy service used to perform REST calls. - */ - private QueuesService service; - - /** - * The service client containing this operation class. - */ - private AzureQueueStorageImpl client; - - /** - * Initializes an instance of QueuesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - public QueuesImpl(AzureQueueStorageImpl client) { - this.service = RestProxy.create(QueuesService.class, client); - this.client = client; - } - - /** - * The interface defining all the services for Queues to be used by the - * proxy service to perform REST calls. - */ - @Host("{url}") - @Service("Storage Queues Queue") - private interface QueuesService { - @PUT("{queueName}") - @ExpectedResponses({201, 204}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono create(@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, Context context); - - @DELETE("{queueName}") - @ExpectedResponses({204}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono delete(@HostParam("url") String url, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, Context context); - - @GET("{queueName}") - @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("comp") String comp, Context context); - - @PUT("{queueName}") - @ExpectedResponses({204}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setMetadata(@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("comp") String comp, Context context); - - @GET("{queueName}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono getAccessPolicy(@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("{queueName}") - @ExpectedResponses({204}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono setAccessPolicy(@HostParam("url") String url, @BodyParam("application/xml; charset=utf-8") SignedIdentifiersWrapper queueAcl, @QueryParam("timeout") Integer timeout, @HeaderParam("x-ms-version") String version, @HeaderParam("x-ms-client-request-id") String requestId, @QueryParam("comp") String comp, Context context); - } - - /** - * creates a new queue under the given account. - * - * @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. - */ - public Mono createWithRestResponseAsync(Context context) { - final Integer timeout = null; - final Map metadata = null; - final String requestId = null; - return service.create(this.client.url(), timeout, metadata, this.client.version(), requestId, context); - } - - /** - * creates a new queue under the given account. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the response body. Note that metadata requested with this parameter must be stored in accordance with the naming restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata names must adhere to the naming conventions for C# identifiers. - * @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. - */ - public Mono createWithRestResponseAsync(Integer timeout, Map metadata, String requestId, Context context) { - return service.create(this.client.url(), timeout, metadata, this.client.version(), requestId, context); - } - - /** - * operation permanently deletes the specified queue. - * - * @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. - */ - public Mono deleteWithRestResponseAsync(Context context) { - final Integer timeout = null; - final String requestId = null; - return service.delete(this.client.url(), timeout, this.client.version(), requestId, context); - } - - /** - * operation permanently deletes the specified queue. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. - * @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. - */ - public Mono deleteWithRestResponseAsync(Integer timeout, String requestId, Context context) { - return service.delete(this.client.url(), timeout, this.client.version(), requestId, context); - } - - /** - * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the queue as name-values pairs. - * - * @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. - */ - public Mono getPropertiesWithRestResponseAsync(Context context) { - final Integer timeout = null; - final String requestId = null; - final String comp = "metadata"; - return service.getProperties(this.client.url(), timeout, this.client.version(), requestId, comp, context); - } - - /** - * Retrieves user-defined metadata and queue properties on the specified queue. Metadata is associated with the queue as name-values pairs. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. - * @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. - */ - public Mono getPropertiesWithRestResponseAsync(Integer timeout, String requestId, Context context) { - final String comp = "metadata"; - return service.getProperties(this.client.url(), timeout, this.client.version(), requestId, comp, context); - } - - /** - * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * - * @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. - */ - public Mono setMetadataWithRestResponseAsync(Context context) { - final Integer timeout = null; - final Map metadata = null; - final String requestId = null; - final String comp = "metadata"; - return service.setMetadata(this.client.url(), timeout, metadata, this.client.version(), requestId, comp, context); - } - - /** - * sets user-defined metadata on the specified queue. Metadata is associated with the queue as name-value pairs. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. - * @param metadata Optional. Include this parameter to specify that the queue's metadata be returned as part of the response body. Note that metadata requested with this parameter must be stored in accordance with the naming restrictions imposed by the 2009-09-19 version of the Queue service. Beginning with this version, all metadata names must adhere to the naming conventions for C# identifiers. - * @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. - */ - public Mono setMetadataWithRestResponseAsync(Integer timeout, Map metadata, String requestId, Context context) { - final String comp = "metadata"; - return service.setMetadata(this.client.url(), timeout, metadata, this.client.version(), requestId, comp, context); - } - - /** - * returns details about any stored access policies specified on the queue that may be used with Shared Access Signatures. - * - * @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. - */ - public Mono getAccessPolicyWithRestResponseAsync(Context context) { - final Integer timeout = null; - final String requestId = null; - final String comp = "acl"; - return service.getAccessPolicy(this.client.url(), timeout, this.client.version(), requestId, comp, context); - } - - /** - * returns details about any stored access policies specified on the queue that may be used with Shared Access Signatures. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. - * @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. - */ - public Mono getAccessPolicyWithRestResponseAsync(Integer timeout, String requestId, Context context) { - final String comp = "acl"; - return service.getAccessPolicy(this.client.url(), timeout, this.client.version(), requestId, comp, context); - } - - /** - * sets stored access policies for the queue that may be used with Shared Access Signatures. - * - * @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. - */ - public Mono setAccessPolicyWithRestResponseAsync(Context context) { - final Integer timeout = null; - final String requestId = null; - final String comp = "acl"; - SignedIdentifiersWrapper queueAclConverted = new SignedIdentifiersWrapper(null); - return service.setAccessPolicy(this.client.url(), queueAclConverted, timeout, this.client.version(), requestId, comp, context); - } - - /** - * sets stored access policies for the queue that may be used with Shared Access Signatures. - * - * @param queueAcl the acls for the queue. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. - * @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. - */ - public Mono setAccessPolicyWithRestResponseAsync(List queueAcl, Integer timeout, String requestId, Context context) { - final String comp = "acl"; - SignedIdentifiersWrapper queueAclConverted = new SignedIdentifiersWrapper(queueAcl); - return service.setAccessPolicy(this.client.url(), queueAclConverted, timeout, this.client.version(), requestId, comp, context); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java b/storage/client/src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java deleted file mode 100644 index dc353d45f5243..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/implementation/ServicesImpl.java +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.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.QueryParam; -import com.azure.core.annotations.Service; -import com.azure.core.annotations.UnexpectedResponseExceptionType; -import com.azure.core.implementation.CollectionFormat; -import com.azure.core.implementation.RestProxy; -import com.azure.core.implementation.serializer.jackson.JacksonAdapter; -import com.azure.core.util.Context; -import com.azure.storage.queue.models.ListQueuesIncludeType; -import com.azure.storage.queue.models.ServicesGetPropertiesResponse; -import com.azure.storage.queue.models.ServicesGetStatisticsResponse; -import com.azure.storage.queue.models.ServicesListQueuesSegmentResponse; -import com.azure.storage.queue.models.ServicesSetPropertiesResponse; -import com.azure.storage.queue.models.StorageErrorException; -import com.azure.storage.queue.models.StorageServiceProperties; -import reactor.core.publisher.Mono; - -import java.util.List; - -/** - * An instance of this class provides access to all the operations defined in - * Services. - */ -public final class ServicesImpl { - /** - * The proxy service used to perform REST calls. - */ - private ServicesService service; - - /** - * The service client containing this operation class. - */ - private AzureQueueStorageImpl client; - - /** - * Initializes an instance of ServicesImpl. - * - * @param client the instance of the service client containing this operation class. - */ - public ServicesImpl(AzureQueueStorageImpl client) { - this.service = RestProxy.create(ServicesService.class, client); - this.client = client; - } - - /** - * The interface defining all the services for Services to be used by the - * proxy service to perform REST calls. - */ - @Host("{url}") - @Service("Storage Queues Services") - private interface ServicesService { - @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("") - @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("") - @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("") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(StorageErrorException.class) - Mono listQueuesSegment(@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("comp") String comp, Context context); - } - - /** - * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. - * - * @param storageServiceProperties 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. - */ - 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); - } - - /** - * Sets properties for a storage account's Queue service endpoint, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. - * - * @param storageServiceProperties The StorageService properties. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. - * @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. - */ - 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); - } - - /** - * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. - * - * @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. - */ - 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); - } - - /** - * gets the properties of a storage account's Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource Sharing) rules. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. - * @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. - */ - 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); - } - - /** - * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account. - * - * @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. - */ - 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); - } - - /** - * Retrieves statistics related to replication for the Queue service. It is only available on the secondary location endpoint when read-access geo-redundant replication is enabled for the storage account. - * - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. - * @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. - */ - 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); - } - - /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @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. - */ - public Mono listQueuesSegmentWithRestResponseAsync(Context context) { - final String prefix = null; - final String marker = null; - final Integer maxresults = null; - final Integer timeout = null; - final String requestId = null; - final String comp = "list"; - String includeConverted = null; - return service.listQueuesSegment(this.client.url(), prefix, marker, maxresults, includeConverted, timeout, this.client.version(), requestId, comp, context); - } - - /** - * The List Queues Segment operation returns a list of the queues under the specified account. - * - * @param prefix Filters the results to return only queues whose name begins with the specified prefix. - * @param marker A string value that identifies the portion of the list of queues to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all queues remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the client. - * @param maxresults Specifies the maximum number of queues to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000. - * @param include Include this parameter to specify that the queues's metadata be returned as part of the response body. - * @param timeout The The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/setting-timeouts-for-queue-service-operations>Setting Timeouts for Queue Service Operations.</a>. - * @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. - */ - public Mono listQueuesSegmentWithRestResponseAsync(String prefix, String marker, Integer maxresults, List include, Integer timeout, String requestId, Context context) { - final String comp = "list"; - String includeConverted = JacksonAdapter.createDefaultSerializerAdapter().serializeList(include, CollectionFormat.CSV); - return service.listQueuesSegment(this.client.url(), prefix, marker, maxresults, includeConverted, timeout, this.client.version(), requestId, comp, context); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/implementation/SignedIdentifiersWrapper.java b/storage/client/src/main/java/com/azure/storage/queue/implementation/SignedIdentifiersWrapper.java deleted file mode 100644 index 092e242ac8b8a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/implementation/SignedIdentifiersWrapper.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.implementation; - -import com.azure.storage.queue.models.SignedIdentifier; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.List; - -/** - * A wrapper around List<SignedIdentifier> which provides top-level metadata for serialization. - */ -@JacksonXmlRootElement(localName = "SignedIdentifiers") -public final class SignedIdentifiersWrapper { - @JacksonXmlProperty(localName = "SignedIdentifier") - private final List signedIdentifiers; - - /** - * Creates an instance of SignedIdentifiersWrapper. - * - * @param signedIdentifiers the list. - */ - @JsonCreator - public SignedIdentifiersWrapper(@JsonProperty("SignedIdentifier") List signedIdentifiers) { - this.signedIdentifiers = signedIdentifiers; - } - - /** - * Get the List<SignedIdentifier> contained in this wrapper. - * - * @return the List<SignedIdentifier>. - */ - public List items() { - return signedIdentifiers; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/implementation/package-info.java b/storage/client/src/main/java/com/azure/storage/queue/implementation/package-info.java deleted file mode 100644 index 80e51df7f9675..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/implementation/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -/** - * This package contains the implementations and inner classes for - * AzureQueueStorage. - */ -package com.azure.storage.queue.implementation; diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/AccessPolicy.java b/storage/client/src/main/java/com/azure/storage/queue/models/AccessPolicy.java deleted file mode 100644 index e2a86de1dcbcd..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/AccessPolicy.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * An Access policy. - */ -@JacksonXmlRootElement(localName = "AccessPolicy") -public final class AccessPolicy { - /* - * the date-time the policy is active - */ - @JsonProperty(value = "Start", required = true) - private OffsetDateTime start; - - /* - * the date-time the policy expires - */ - @JsonProperty(value = "Expiry", required = true) - private OffsetDateTime expiry; - - /* - * the permissions for the acl policy - */ - @JsonProperty(value = "Permission", required = true) - private String permission; - - /** - * Get the start property: the date-time the policy is active. - * - * @return the start value. - */ - public OffsetDateTime start() { - return this.start; - } - - /** - * Set the start property: the date-time the policy is active. - * - * @param start the start value to set. - * @return the AccessPolicy object itself. - */ - public AccessPolicy start(OffsetDateTime start) { - this.start = start; - return this; - } - - /** - * Get the expiry property: the date-time the policy expires. - * - * @return the expiry value. - */ - public OffsetDateTime expiry() { - return this.expiry; - } - - /** - * Set the expiry property: the date-time the policy expires. - * - * @param expiry the expiry value to set. - * @return the AccessPolicy object itself. - */ - public AccessPolicy expiry(OffsetDateTime expiry) { - this.expiry = expiry; - return this; - } - - /** - * Get the permission property: the permissions for the acl policy. - * - * @return the permission value. - */ - public String permission() { - return this.permission; - } - - /** - * Set the permission property: the permissions for the acl policy. - * - * @param permission the permission value to set. - * @return the AccessPolicy object itself. - */ - public AccessPolicy permission(String permission) { - this.permission = permission; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/CorsRule.java b/storage/client/src/main/java/com/azure/storage/queue/models/CorsRule.java deleted file mode 100644 index e5836439cdf3e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/CorsRule.java +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * CORS is an HTTP feature that enables a web application running under one - * domain to access resources in another domain. Web browsers implement a - * security restriction known as same-origin policy that prevents a web page - * from calling APIs in a different domain; CORS provides a secure way to allow - * one domain (the origin domain) to call APIs in another domain. - */ -@JacksonXmlRootElement(localName = "CorsRule") -public final class CorsRule { - /* - * The origin domains that are permitted to make a request against the - * storage service via CORS. The origin domain is the domain from which the - * request originates. Note that the origin must be an exact case-sensitive - * match with the origin that the user age sends to the service. You can - * also use the wildcard character '*' to allow all origin domains to make - * requests via CORS. - */ - @JsonProperty(value = "AllowedOrigins", required = true) - private String allowedOrigins; - - /* - * The methods (HTTP request verbs) that the origin domain may use for a - * CORS request. (comma separated) - */ - @JsonProperty(value = "AllowedMethods", required = true) - private String allowedMethods; - - /* - * the request headers that the origin domain may specify on the CORS - * request. - */ - @JsonProperty(value = "AllowedHeaders", required = true) - private String allowedHeaders; - - /* - * The response headers that may be sent in the response to the CORS - * request and exposed by the browser to the request issuer - */ - @JsonProperty(value = "ExposedHeaders", required = true) - private String exposedHeaders; - - /* - * The maximum amount time that a browser should cache the preflight - * OPTIONS request. - */ - @JsonProperty(value = "MaxAgeInSeconds", required = true) - private int maxAgeInSeconds; - - /** - * Get the allowedOrigins property: The origin domains that are permitted - * to make a request against the storage service via CORS. The origin - * domain is the domain from which the request originates. Note that the - * origin must be an exact case-sensitive match with the origin that the - * user age sends to the service. You can also use the wildcard character - * '*' to allow all origin domains to make requests via CORS. - * - * @return the allowedOrigins value. - */ - public String allowedOrigins() { - return this.allowedOrigins; - } - - /** - * Set the allowedOrigins property: The origin domains that are permitted - * to make a request against the storage service via CORS. The origin - * domain is the domain from which the request originates. Note that the - * origin must be an exact case-sensitive match with the origin that the - * user age sends to the service. You can also use the wildcard character - * '*' to allow all origin domains to make requests via CORS. - * - * @param allowedOrigins the allowedOrigins value to set. - * @return the CorsRule object itself. - */ - public CorsRule allowedOrigins(String allowedOrigins) { - this.allowedOrigins = allowedOrigins; - return this; - } - - /** - * Get the allowedMethods property: The methods (HTTP request verbs) that - * the origin domain may use for a CORS request. (comma separated). - * - * @return the allowedMethods value. - */ - public String allowedMethods() { - return this.allowedMethods; - } - - /** - * Set the allowedMethods property: The methods (HTTP request verbs) that - * the origin domain may use for a CORS request. (comma separated). - * - * @param allowedMethods the allowedMethods value to set. - * @return the CorsRule object itself. - */ - public CorsRule allowedMethods(String allowedMethods) { - this.allowedMethods = allowedMethods; - return this; - } - - /** - * Get the allowedHeaders property: the request headers that the origin - * domain may specify on the CORS request. - * - * @return the allowedHeaders value. - */ - public String allowedHeaders() { - return this.allowedHeaders; - } - - /** - * Set the allowedHeaders property: the request headers that the origin - * domain may specify on the CORS request. - * - * @param allowedHeaders the allowedHeaders value to set. - * @return the CorsRule object itself. - */ - public CorsRule allowedHeaders(String allowedHeaders) { - this.allowedHeaders = allowedHeaders; - return this; - } - - /** - * Get the exposedHeaders property: The response headers that may be sent - * in the response to the CORS request and exposed by the browser to the - * request issuer. - * - * @return the exposedHeaders value. - */ - public String exposedHeaders() { - return this.exposedHeaders; - } - - /** - * Set the exposedHeaders property: The response headers that may be sent - * in the response to the CORS request and exposed by the browser to the - * request issuer. - * - * @param exposedHeaders the exposedHeaders value to set. - * @return the CorsRule object itself. - */ - public CorsRule exposedHeaders(String exposedHeaders) { - this.exposedHeaders = exposedHeaders; - return this; - } - - /** - * Get the maxAgeInSeconds property: The maximum amount time that a browser - * should cache the preflight OPTIONS request. - * - * @return the maxAgeInSeconds value. - */ - public int maxAgeInSeconds() { - return this.maxAgeInSeconds; - } - - /** - * Set the maxAgeInSeconds property: The maximum amount time that a browser - * should cache the preflight OPTIONS request. - * - * @param maxAgeInSeconds the maxAgeInSeconds value to set. - * @return the CorsRule object itself. - */ - public CorsRule maxAgeInSeconds(int maxAgeInSeconds) { - this.maxAgeInSeconds = maxAgeInSeconds; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/DequeuedMessageItem.java b/storage/client/src/main/java/com/azure/storage/queue/models/DequeuedMessageItem.java deleted file mode 100644 index 7febd2c02758d..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/DequeuedMessageItem.java +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * The object returned in the QueueMessageList array when calling Get Messages - * on a Queue. - */ -@JacksonXmlRootElement(localName = "QueueMessage") -public final class DequeuedMessageItem { - /* - * The Id of the Message. - */ - @JsonProperty(value = "MessageId", required = true) - private String messageId; - - /* - * The time the Message was inserted into the Queue. - */ - @JsonProperty(value = "InsertionTime", required = true) - private DateTimeRfc1123 insertionTime; - - /* - * The time that the Message will expire and be automatically deleted. - */ - @JsonProperty(value = "ExpirationTime", required = true) - private DateTimeRfc1123 expirationTime; - - /* - * This value is required to delete the Message. If deletion fails using - * this popreceipt then the message has been dequeued by another client. - */ - @JsonProperty(value = "PopReceipt", required = true) - private String popReceipt; - - /* - * The time that the message will again become visible in the Queue. - */ - @JsonProperty(value = "TimeNextVisible", required = true) - private DateTimeRfc1123 timeNextVisible; - - /* - * The number of times the message has been dequeued. - */ - @JsonProperty(value = "DequeueCount", required = true) - private long dequeueCount; - - /* - * The content of the Message. - */ - @JsonProperty(value = "MessageText", required = true) - private String messageText; - - /** - * Get the messageId property: The Id of the Message. - * - * @return the messageId value. - */ - public String messageId() { - return this.messageId; - } - - /** - * Set the messageId property: The Id of the Message. - * - * @param messageId the messageId value to set. - * @return the DequeuedMessageItem object itself. - */ - public DequeuedMessageItem messageId(String messageId) { - this.messageId = messageId; - return this; - } - - /** - * Get the insertionTime property: The time the Message was inserted into - * the Queue. - * - * @return the insertionTime value. - */ - public OffsetDateTime insertionTime() { - if (this.insertionTime == null) { - return null; - } - return this.insertionTime.dateTime(); - } - - /** - * Set the insertionTime property: The time the Message was inserted into - * the Queue. - * - * @param insertionTime the insertionTime value to set. - * @return the DequeuedMessageItem object itself. - */ - public DequeuedMessageItem insertionTime(OffsetDateTime insertionTime) { - if (insertionTime == null) { - this.insertionTime = null; - } else { - this.insertionTime = new DateTimeRfc1123(insertionTime); - } - return this; - } - - /** - * Get the expirationTime property: The time that the Message will expire - * and be automatically deleted. - * - * @return the expirationTime value. - */ - public OffsetDateTime expirationTime() { - if (this.expirationTime == null) { - return null; - } - return this.expirationTime.dateTime(); - } - - /** - * Set the expirationTime property: The time that the Message will expire - * and be automatically deleted. - * - * @param expirationTime the expirationTime value to set. - * @return the DequeuedMessageItem object itself. - */ - public DequeuedMessageItem expirationTime(OffsetDateTime expirationTime) { - if (expirationTime == null) { - this.expirationTime = null; - } else { - this.expirationTime = new DateTimeRfc1123(expirationTime); - } - return this; - } - - /** - * Get the popReceipt property: This value is required to delete the - * Message. If deletion fails using this popreceipt then the message has - * been dequeued by another client. - * - * @return the popReceipt value. - */ - public String popReceipt() { - return this.popReceipt; - } - - /** - * Set the popReceipt property: This value is required to delete the - * Message. If deletion fails using this popreceipt then the message has - * been dequeued by another client. - * - * @param popReceipt the popReceipt value to set. - * @return the DequeuedMessageItem object itself. - */ - public DequeuedMessageItem popReceipt(String popReceipt) { - this.popReceipt = popReceipt; - return this; - } - - /** - * Get the timeNextVisible property: The time that the message will again - * become visible in the Queue. - * - * @return the timeNextVisible value. - */ - public OffsetDateTime timeNextVisible() { - if (this.timeNextVisible == null) { - return null; - } - return this.timeNextVisible.dateTime(); - } - - /** - * Set the timeNextVisible property: The time that the message will again - * become visible in the Queue. - * - * @param timeNextVisible the timeNextVisible value to set. - * @return the DequeuedMessageItem object itself. - */ - public DequeuedMessageItem timeNextVisible(OffsetDateTime timeNextVisible) { - if (timeNextVisible == null) { - this.timeNextVisible = null; - } else { - this.timeNextVisible = new DateTimeRfc1123(timeNextVisible); - } - return this; - } - - /** - * Get the dequeueCount property: The number of times the message has been - * dequeued. - * - * @return the dequeueCount value. - */ - public long dequeueCount() { - return this.dequeueCount; - } - - /** - * Set the dequeueCount property: The number of times the message has been - * dequeued. - * - * @param dequeueCount the dequeueCount value to set. - * @return the DequeuedMessageItem object itself. - */ - public DequeuedMessageItem dequeueCount(long dequeueCount) { - this.dequeueCount = dequeueCount; - return this; - } - - /** - * Get the messageText property: The content of the Message. - * - * @return the messageText value. - */ - public String messageText() { - return this.messageText; - } - - /** - * Set the messageText property: The content of the Message. - * - * @param messageText the messageText value to set. - * @return the DequeuedMessageItem object itself. - */ - public DequeuedMessageItem messageText(String messageText) { - this.messageText = messageText; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/EnqueuedMessage.java b/storage/client/src/main/java/com/azure/storage/queue/models/EnqueuedMessage.java deleted file mode 100644 index 16f1cccb9e244..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/EnqueuedMessage.java +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * The object returned in the QueueMessageList array when calling Put Message - * on a Queue. - */ -@JacksonXmlRootElement(localName = "QueueMessage") -public final class EnqueuedMessage { - /* - * The Id of the Message. - */ - @JsonProperty(value = "MessageId", required = true) - private String messageId; - - /* - * The time the Message was inserted into the Queue. - */ - @JsonProperty(value = "InsertionTime", required = true) - private DateTimeRfc1123 insertionTime; - - /* - * The time that the Message will expire and be automatically deleted. - */ - @JsonProperty(value = "ExpirationTime", required = true) - private DateTimeRfc1123 expirationTime; - - /* - * This value is required to delete the Message. If deletion fails using - * this popreceipt then the message has been dequeued by another client. - */ - @JsonProperty(value = "PopReceipt", required = true) - private String popReceipt; - - /* - * The time that the message will again become visible in the Queue. - */ - @JsonProperty(value = "TimeNextVisible", required = true) - private DateTimeRfc1123 timeNextVisible; - - /** - * Get the messageId property: The Id of the Message. - * - * @return the messageId value. - */ - public String messageId() { - return this.messageId; - } - - /** - * Set the messageId property: The Id of the Message. - * - * @param messageId the messageId value to set. - * @return the EnqueuedMessage object itself. - */ - public EnqueuedMessage messageId(String messageId) { - this.messageId = messageId; - return this; - } - - /** - * Get the insertionTime property: The time the Message was inserted into - * the Queue. - * - * @return the insertionTime value. - */ - public OffsetDateTime insertionTime() { - if (this.insertionTime == null) { - return null; - } - return this.insertionTime.dateTime(); - } - - /** - * Set the insertionTime property: The time the Message was inserted into - * the Queue. - * - * @param insertionTime the insertionTime value to set. - * @return the EnqueuedMessage object itself. - */ - public EnqueuedMessage insertionTime(OffsetDateTime insertionTime) { - if (insertionTime == null) { - this.insertionTime = null; - } else { - this.insertionTime = new DateTimeRfc1123(insertionTime); - } - return this; - } - - /** - * Get the expirationTime property: The time that the Message will expire - * and be automatically deleted. - * - * @return the expirationTime value. - */ - public OffsetDateTime expirationTime() { - if (this.expirationTime == null) { - return null; - } - return this.expirationTime.dateTime(); - } - - /** - * Set the expirationTime property: The time that the Message will expire - * and be automatically deleted. - * - * @param expirationTime the expirationTime value to set. - * @return the EnqueuedMessage object itself. - */ - public EnqueuedMessage expirationTime(OffsetDateTime expirationTime) { - if (expirationTime == null) { - this.expirationTime = null; - } else { - this.expirationTime = new DateTimeRfc1123(expirationTime); - } - return this; - } - - /** - * Get the popReceipt property: This value is required to delete the - * Message. If deletion fails using this popreceipt then the message has - * been dequeued by another client. - * - * @return the popReceipt value. - */ - public String popReceipt() { - return this.popReceipt; - } - - /** - * Set the popReceipt property: This value is required to delete the - * Message. If deletion fails using this popreceipt then the message has - * been dequeued by another client. - * - * @param popReceipt the popReceipt value to set. - * @return the EnqueuedMessage object itself. - */ - public EnqueuedMessage popReceipt(String popReceipt) { - this.popReceipt = popReceipt; - return this; - } - - /** - * Get the timeNextVisible property: The time that the message will again - * become visible in the Queue. - * - * @return the timeNextVisible value. - */ - public OffsetDateTime timeNextVisible() { - if (this.timeNextVisible == null) { - return null; - } - return this.timeNextVisible.dateTime(); - } - - /** - * Set the timeNextVisible property: The time that the message will again - * become visible in the Queue. - * - * @param timeNextVisible the timeNextVisible value to set. - * @return the EnqueuedMessage object itself. - */ - public EnqueuedMessage timeNextVisible(OffsetDateTime timeNextVisible) { - if (timeNextVisible == null) { - this.timeNextVisible = null; - } else { - this.timeNextVisible = new DateTimeRfc1123(timeNextVisible); - } - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/GeoReplication.java b/storage/client/src/main/java/com/azure/storage/queue/models/GeoReplication.java deleted file mode 100644 index 1fc313b4a45b2..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/GeoReplication.java +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * The GeoReplication model. - */ -@JacksonXmlRootElement(localName = "GeoReplication") -public final class GeoReplication { - /* - * The status of the secondary location. Possible values include: 'live', - * 'bootstrap', 'unavailable' - */ - @JsonProperty(value = "Status", required = true) - private GeoReplicationStatusType status; - - /* - * A GMT date/time value, to the second. All primary writes preceding this - * value are guaranteed to be available for read operations at the - * secondary. Primary writes after this point in time may or may not be - * available for reads. - */ - @JsonProperty(value = "LastSyncTime", required = true) - private DateTimeRfc1123 lastSyncTime; - - /** - * Get the status property: The status of the secondary location. Possible - * values include: 'live', 'bootstrap', 'unavailable'. - * - * @return the status value. - */ - public GeoReplicationStatusType status() { - return this.status; - } - - /** - * Set the status property: The status of the secondary location. Possible - * values include: 'live', 'bootstrap', 'unavailable'. - * - * @param status the status value to set. - * @return the GeoReplication object itself. - */ - public GeoReplication status(GeoReplicationStatusType status) { - this.status = status; - return this; - } - - /** - * Get the lastSyncTime property: A GMT date/time value, to the second. All - * primary writes preceding this value are guaranteed to be available for - * read operations at the secondary. Primary writes after this point in - * time may or may not be available for reads. - * - * @return the lastSyncTime value. - */ - public OffsetDateTime lastSyncTime() { - if (this.lastSyncTime == null) { - return null; - } - return this.lastSyncTime.dateTime(); - } - - /** - * Set the lastSyncTime property: A GMT date/time value, to the second. All - * primary writes preceding this value are guaranteed to be available for - * read operations at the secondary. Primary writes after this point in - * time may or may not be available for reads. - * - * @param lastSyncTime the lastSyncTime value to set. - * @return the GeoReplication object itself. - */ - public GeoReplication lastSyncTime(OffsetDateTime lastSyncTime) { - if (lastSyncTime == null) { - this.lastSyncTime = null; - } else { - this.lastSyncTime = new DateTimeRfc1123(lastSyncTime); - } - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/GeoReplicationStatusType.java b/storage/client/src/main/java/com/azure/storage/queue/models/GeoReplicationStatusType.java deleted file mode 100644 index 0238afe0211ec..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/GeoReplicationStatusType.java +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** - * Defines values for GeoReplicationStatusType. - */ -public final class GeoReplicationStatusType extends ExpandableStringEnum { - /** - * Static value live for GeoReplicationStatusType. - */ - public static final GeoReplicationStatusType LIVE = fromString("live"); - - /** - * Static value bootstrap for GeoReplicationStatusType. - */ - public static final GeoReplicationStatusType BOOTSTRAP = fromString("bootstrap"); - - /** - * Static value unavailable for GeoReplicationStatusType. - */ - public static final GeoReplicationStatusType UNAVAILABLE = fromString("unavailable"); - - /** - * Creates or finds a GeoReplicationStatusType from its string representation. - * - * @param name a name to look for. - * @return the corresponding GeoReplicationStatusType. - */ - @JsonCreator - public static GeoReplicationStatusType fromString(String name) { - return fromString(name, GeoReplicationStatusType.class); - } - - /** - * @return known GeoReplicationStatusType values. - */ - public static Collection values() { - return values(GeoReplicationStatusType.class); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/ListQueuesIncludeType.java b/storage/client/src/main/java/com/azure/storage/queue/models/ListQueuesIncludeType.java deleted file mode 100644 index e2d7974714006..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/ListQueuesIncludeType.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** - * Defines values for ListQueuesIncludeType. - */ -public enum ListQueuesIncludeType { - /** - * Enum value metadata. - */ - METADATA("metadata"); - - /** - * The actual serialized value for a ListQueuesIncludeType instance. - */ - private final String value; - - ListQueuesIncludeType(String value) { - this.value = value; - } - - /** - * Parses a serialized value to a ListQueuesIncludeType instance. - * - * @param value the serialized value to parse. - * @return the parsed ListQueuesIncludeType object, or null if unable to parse. - */ - @JsonCreator - public static ListQueuesIncludeType fromString(String value) { - ListQueuesIncludeType[] items = ListQueuesIncludeType.values(); - for (ListQueuesIncludeType item : items) { - if (item.toString().equalsIgnoreCase(value)) { - return item; - } - } - return null; - } - - @JsonValue - @Override - public String toString() { - return this.value; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/ListQueuesSegmentResponse.java b/storage/client/src/main/java/com/azure/storage/queue/models/ListQueuesSegmentResponse.java deleted file mode 100644 index 8e34bc50503ba..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/ListQueuesSegmentResponse.java +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.ArrayList; -import java.util.List; - -/** - * The object returned when calling List Queues on a Queue Service. - */ -@JacksonXmlRootElement(localName = "EnumerationResults") -public final class ListQueuesSegmentResponse { - /* - * The serviceEndpoint property. - */ - @JacksonXmlProperty(localName = "ServiceEndpoint", isAttribute = true) - private String serviceEndpoint; - - /* - * The prefix property. - */ - @JsonProperty(value = "Prefix", required = true) - private String prefix; - - /* - * The marker property. - */ - @JsonProperty(value = "Marker") - private String marker; - - /* - * The maxResults property. - */ - @JsonProperty(value = "MaxResults", required = true) - private int maxResults; - - private static final class QueuesWrapper { - @JacksonXmlProperty(localName = "Queue") - private final List items; - - @JsonCreator - private QueuesWrapper(@JacksonXmlProperty(localName = "Queue") List items) { - this.items = items; - } - } - - /* - * The queueItems property. - */ - @JsonProperty(value = "Queues") - private QueuesWrapper queueItems; - - /* - * The nextMarker property. - */ - @JsonProperty(value = "NextMarker", required = true) - private String nextMarker; - - /** - * Get the serviceEndpoint property: The serviceEndpoint property. - * - * @return the serviceEndpoint value. - */ - public String serviceEndpoint() { - return this.serviceEndpoint; - } - - /** - * Set the serviceEndpoint property: The serviceEndpoint property. - * - * @param serviceEndpoint the serviceEndpoint value to set. - * @return the ListQueuesSegmentResponse object itself. - */ - public ListQueuesSegmentResponse serviceEndpoint(String serviceEndpoint) { - this.serviceEndpoint = serviceEndpoint; - return this; - } - - /** - * Get the prefix property: The prefix property. - * - * @return the prefix value. - */ - public String prefix() { - return this.prefix; - } - - /** - * Set the prefix property: The prefix property. - * - * @param prefix the prefix value to set. - * @return the ListQueuesSegmentResponse object itself. - */ - public ListQueuesSegmentResponse prefix(String prefix) { - this.prefix = prefix; - return this; - } - - /** - * Get the marker property: The marker property. - * - * @return the marker value. - */ - public String marker() { - return this.marker; - } - - /** - * Set the marker property: The marker property. - * - * @param marker the marker value to set. - * @return the ListQueuesSegmentResponse object itself. - */ - public ListQueuesSegmentResponse marker(String marker) { - this.marker = marker; - return this; - } - - /** - * Get the maxResults property: The maxResults property. - * - * @return the maxResults value. - */ - public int maxResults() { - return this.maxResults; - } - - /** - * Set the maxResults property: The maxResults property. - * - * @param maxResults the maxResults value to set. - * @return the ListQueuesSegmentResponse object itself. - */ - public ListQueuesSegmentResponse maxResults(int maxResults) { - this.maxResults = maxResults; - return this; - } - - /** - * Get the queueItems property: The queueItems property. - * - * @return the queueItems value. - */ - public List queueItems() { - if (this.queueItems == null) { - this.queueItems = new QueuesWrapper(new ArrayList()); - } - return this.queueItems.items; - } - - /** - * Set the queueItems property: The queueItems property. - * - * @param queueItems the queueItems value to set. - * @return the ListQueuesSegmentResponse object itself. - */ - public ListQueuesSegmentResponse queueItems(List queueItems) { - this.queueItems = new QueuesWrapper(queueItems); - return this; - } - - /** - * Get the nextMarker property: The nextMarker property. - * - * @return the nextMarker value. - */ - public String nextMarker() { - return this.nextMarker; - } - - /** - * Set the nextMarker property: The nextMarker property. - * - * @param nextMarker the nextMarker value to set. - * @return the ListQueuesSegmentResponse object itself. - */ - public ListQueuesSegmentResponse nextMarker(String nextMarker) { - this.nextMarker = nextMarker; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/Logging.java b/storage/client/src/main/java/com/azure/storage/queue/models/Logging.java deleted file mode 100644 index c5289b4fb5a50..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/Logging.java +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Azure Analytics Logging settings. - */ -@JacksonXmlRootElement(localName = "Logging") -public final class Logging { - /* - * The version of Storage Analytics to configure. - */ - @JsonProperty(value = "Version", required = true) - private String version; - - /* - * Indicates whether all delete requests should be logged. - */ - @JsonProperty(value = "Delete", required = true) - private boolean delete; - - /* - * Indicates whether all read requests should be logged. - */ - @JsonProperty(value = "Read", required = true) - private boolean read; - - /* - * Indicates whether all write requests should be logged. - */ - @JsonProperty(value = "Write", required = true) - private boolean write; - - /* - * The retentionPolicy property. - */ - @JsonProperty(value = "RetentionPolicy", required = true) - private RetentionPolicy retentionPolicy; - - /** - * Get the version property: The version of Storage Analytics to configure. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: The version of Storage Analytics to configure. - * - * @param version the version value to set. - * @return the Logging object itself. - */ - public Logging version(String version) { - this.version = version; - return this; - } - - /** - * Get the delete property: Indicates whether all delete requests should be - * logged. - * - * @return the delete value. - */ - public boolean delete() { - return this.delete; - } - - /** - * Set the delete property: Indicates whether all delete requests should be - * logged. - * - * @param delete the delete value to set. - * @return the Logging object itself. - */ - public Logging delete(boolean delete) { - this.delete = delete; - return this; - } - - /** - * Get the read property: Indicates whether all read requests should be - * logged. - * - * @return the read value. - */ - public boolean read() { - return this.read; - } - - /** - * Set the read property: Indicates whether all read requests should be - * logged. - * - * @param read the read value to set. - * @return the Logging object itself. - */ - public Logging read(boolean read) { - this.read = read; - return this; - } - - /** - * Get the write property: Indicates whether all write requests should be - * logged. - * - * @return the write value. - */ - public boolean write() { - return this.write; - } - - /** - * Set the write property: Indicates whether all write requests should be - * logged. - * - * @param write the write value to set. - * @return the Logging object itself. - */ - public Logging write(boolean write) { - this.write = write; - return this; - } - - /** - * Get the retentionPolicy property: The retentionPolicy property. - * - * @return the retentionPolicy value. - */ - public RetentionPolicy retentionPolicy() { - return this.retentionPolicy; - } - - /** - * Set the retentionPolicy property: The retentionPolicy property. - * - * @param retentionPolicy the retentionPolicy value to set. - * @return the Logging object itself. - */ - public Logging retentionPolicy(RetentionPolicy retentionPolicy) { - this.retentionPolicy = retentionPolicy; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/MessageIdDeleteHeaders.java b/storage/client/src/main/java/com/azure/storage/queue/models/MessageIdDeleteHeaders.java deleted file mode 100644 index e369a4d60c99d..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/MessageIdDeleteHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Delete operation. - */ -@JacksonXmlRootElement(localName = "MessageId-Delete-Headers") -public final class MessageIdDeleteHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Queue service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the MessageIdDeleteHeaders object itself. - */ - public MessageIdDeleteHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the MessageIdDeleteHeaders object itself. - */ - public MessageIdDeleteHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the MessageIdDeleteHeaders object itself. - */ - public MessageIdDeleteHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the MessageIdDeleteHeaders object itself. - */ - public MessageIdDeleteHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/MessageIdUpdateHeaders.java b/storage/client/src/main/java/com/azure/storage/queue/models/MessageIdUpdateHeaders.java deleted file mode 100644 index a0129420618db..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/MessageIdUpdateHeaders.java +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Update operation. - */ -@JacksonXmlRootElement(localName = "MessageId-Update-Headers") -public final class MessageIdUpdateHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Queue service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The pop receipt of the queue message. - */ - @JsonProperty(value = "x-ms-popreceipt") - private String popReceipt; - - /* - * A UTC date/time value that represents when the message will be visible - * on the queue. - */ - @JsonProperty(value = "x-ms-time-next-visible") - private DateTimeRfc1123 timeNextVisible; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the MessageIdUpdateHeaders object itself. - */ - public MessageIdUpdateHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the MessageIdUpdateHeaders object itself. - */ - public MessageIdUpdateHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the MessageIdUpdateHeaders object itself. - */ - public MessageIdUpdateHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the popReceipt property: The pop receipt of the queue message. - * - * @return the popReceipt value. - */ - public String popReceipt() { - return this.popReceipt; - } - - /** - * Set the popReceipt property: The pop receipt of the queue message. - * - * @param popReceipt the popReceipt value to set. - * @return the MessageIdUpdateHeaders object itself. - */ - public MessageIdUpdateHeaders popReceipt(String popReceipt) { - this.popReceipt = popReceipt; - return this; - } - - /** - * Get the timeNextVisible property: A UTC date/time value that represents - * when the message will be visible on the queue. - * - * @return the timeNextVisible value. - */ - public OffsetDateTime timeNextVisible() { - if (this.timeNextVisible == null) { - return null; - } - return this.timeNextVisible.dateTime(); - } - - /** - * Set the timeNextVisible property: A UTC date/time value that represents - * when the message will be visible on the queue. - * - * @param timeNextVisible the timeNextVisible value to set. - * @return the MessageIdUpdateHeaders object itself. - */ - public MessageIdUpdateHeaders timeNextVisible(OffsetDateTime timeNextVisible) { - if (timeNextVisible == null) { - this.timeNextVisible = null; - } else { - this.timeNextVisible = new DateTimeRfc1123(timeNextVisible); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the MessageIdUpdateHeaders object itself. - */ - public MessageIdUpdateHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/MessageIdsDeleteResponse.java b/storage/client/src/main/java/com/azure/storage/queue/models/MessageIdsDeleteResponse.java deleted file mode 100644 index 3639b840adfdd..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/MessageIdsDeleteResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the delete operation. - */ -public final class MessageIdsDeleteResponse extends ResponseBase { - /** - * Creates an instance of MessageIdsDeleteResponse. - * - * @param request the request which resulted in this MessageIdsDeleteResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public MessageIdsDeleteResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, MessageIdDeleteHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/MessageIdsUpdateResponse.java b/storage/client/src/main/java/com/azure/storage/queue/models/MessageIdsUpdateResponse.java deleted file mode 100644 index 4305b7c915ec9..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/MessageIdsUpdateResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the update operation. - */ -public final class MessageIdsUpdateResponse extends ResponseBase { - /** - * Creates an instance of MessageIdsUpdateResponse. - * - * @param request the request which resulted in this MessageIdsUpdateResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public MessageIdsUpdateResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, MessageIdUpdateHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/MessagesClearHeaders.java b/storage/client/src/main/java/com/azure/storage/queue/models/MessagesClearHeaders.java deleted file mode 100644 index 6bb1165cb4de1..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/MessagesClearHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Clear operation. - */ -@JacksonXmlRootElement(localName = "Messages-Clear-Headers") -public final class MessagesClearHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Queue service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the MessagesClearHeaders object itself. - */ - public MessagesClearHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the MessagesClearHeaders object itself. - */ - public MessagesClearHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the MessagesClearHeaders object itself. - */ - public MessagesClearHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the MessagesClearHeaders object itself. - */ - public MessagesClearHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/MessagesClearResponse.java b/storage/client/src/main/java/com/azure/storage/queue/models/MessagesClearResponse.java deleted file mode 100644 index d21b99d0f839a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/MessagesClearResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the clear operation. - */ -public final class MessagesClearResponse extends ResponseBase { - /** - * Creates an instance of MessagesClearResponse. - * - * @param request the request which resulted in this MessagesClearResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public MessagesClearResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, MessagesClearHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/MessagesDequeueHeaders.java b/storage/client/src/main/java/com/azure/storage/queue/models/MessagesDequeueHeaders.java deleted file mode 100644 index 3957cd8a79d41..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/MessagesDequeueHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Dequeue operation. - */ -@JacksonXmlRootElement(localName = "Messages-Dequeue-Headers") -public final class MessagesDequeueHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Queue service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the MessagesDequeueHeaders object itself. - */ - public MessagesDequeueHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the MessagesDequeueHeaders object itself. - */ - public MessagesDequeueHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the MessagesDequeueHeaders object itself. - */ - public MessagesDequeueHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the MessagesDequeueHeaders object itself. - */ - public MessagesDequeueHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/MessagesDequeueResponse.java b/storage/client/src/main/java/com/azure/storage/queue/models/MessagesDequeueResponse.java deleted file mode 100644 index 4ab4b09a4a620..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/MessagesDequeueResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; -import java.util.List; - -/** - * Contains all response data for the dequeue operation. - */ -public final class MessagesDequeueResponse extends ResponseBase> { - /** - * Creates an instance of MessagesDequeueResponse. - * - * @param request the request which resulted in this MessagesDequeueResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public MessagesDequeueResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, List value, MessagesDequeueHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public List value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/MessagesEnqueueHeaders.java b/storage/client/src/main/java/com/azure/storage/queue/models/MessagesEnqueueHeaders.java deleted file mode 100644 index 39dc57ed0c2a1..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/MessagesEnqueueHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Enqueue operation. - */ -@JacksonXmlRootElement(localName = "Messages-Enqueue-Headers") -public final class MessagesEnqueueHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Queue service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the MessagesEnqueueHeaders object itself. - */ - public MessagesEnqueueHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the MessagesEnqueueHeaders object itself. - */ - public MessagesEnqueueHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the MessagesEnqueueHeaders object itself. - */ - public MessagesEnqueueHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the MessagesEnqueueHeaders object itself. - */ - public MessagesEnqueueHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/MessagesEnqueueResponse.java b/storage/client/src/main/java/com/azure/storage/queue/models/MessagesEnqueueResponse.java deleted file mode 100644 index 079778e006762..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/MessagesEnqueueResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; -import java.util.List; - -/** - * Contains all response data for the enqueue operation. - */ -public final class MessagesEnqueueResponse extends ResponseBase> { - /** - * Creates an instance of MessagesEnqueueResponse. - * - * @param request the request which resulted in this MessagesEnqueueResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public MessagesEnqueueResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, List value, MessagesEnqueueHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public List value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/MessagesPeekHeaders.java b/storage/client/src/main/java/com/azure/storage/queue/models/MessagesPeekHeaders.java deleted file mode 100644 index 4733069112ace..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/MessagesPeekHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Peek operation. - */ -@JacksonXmlRootElement(localName = "Messages-Peek-Headers") -public final class MessagesPeekHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Queue service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the MessagesPeekHeaders object itself. - */ - public MessagesPeekHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the MessagesPeekHeaders object itself. - */ - public MessagesPeekHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the MessagesPeekHeaders object itself. - */ - public MessagesPeekHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the MessagesPeekHeaders object itself. - */ - public MessagesPeekHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/MessagesPeekResponse.java b/storage/client/src/main/java/com/azure/storage/queue/models/MessagesPeekResponse.java deleted file mode 100644 index 8ca8ed06fd99c..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/MessagesPeekResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; -import java.util.List; - -/** - * Contains all response data for the peek operation. - */ -public final class MessagesPeekResponse extends ResponseBase> { - /** - * Creates an instance of MessagesPeekResponse. - * - * @param request the request which resulted in this MessagesPeekResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public MessagesPeekResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, List value, MessagesPeekHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public List value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/Metrics.java b/storage/client/src/main/java/com/azure/storage/queue/models/Metrics.java deleted file mode 100644 index 8c9b2fe7923ae..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/Metrics.java +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * The Metrics model. - */ -@JacksonXmlRootElement(localName = "Metrics") -public final class Metrics { - /* - * The version of Storage Analytics to configure. - */ - @JsonProperty(value = "Version") - private String version; - - /* - * Indicates whether metrics are enabled for the Queue service. - */ - @JsonProperty(value = "Enabled", required = true) - private boolean enabled; - - /* - * Indicates whether metrics should generate summary statistics for called - * API operations. - */ - @JsonProperty(value = "IncludeAPIs") - private Boolean includeAPIs; - - /* - * The retentionPolicy property. - */ - @JsonProperty(value = "RetentionPolicy") - private RetentionPolicy retentionPolicy; - - /** - * Get the version property: The version of Storage Analytics to configure. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: The version of Storage Analytics to configure. - * - * @param version the version value to set. - * @return the Metrics object itself. - */ - public Metrics version(String version) { - this.version = version; - return this; - } - - /** - * Get the enabled property: Indicates whether metrics are enabled for the - * Queue service. - * - * @return the enabled value. - */ - public boolean enabled() { - return this.enabled; - } - - /** - * Set the enabled property: Indicates whether metrics are enabled for the - * Queue service. - * - * @param enabled the enabled value to set. - * @return the Metrics object itself. - */ - public Metrics enabled(boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Get the includeAPIs property: Indicates whether metrics should generate - * summary statistics for called API operations. - * - * @return the includeAPIs value. - */ - public Boolean includeAPIs() { - return this.includeAPIs; - } - - /** - * Set the includeAPIs property: Indicates whether metrics should generate - * summary statistics for called API operations. - * - * @param includeAPIs the includeAPIs value to set. - * @return the Metrics object itself. - */ - public Metrics includeAPIs(Boolean includeAPIs) { - this.includeAPIs = includeAPIs; - return this; - } - - /** - * Get the retentionPolicy property: The retentionPolicy property. - * - * @return the retentionPolicy value. - */ - public RetentionPolicy retentionPolicy() { - return this.retentionPolicy; - } - - /** - * Set the retentionPolicy property: The retentionPolicy property. - * - * @param retentionPolicy the retentionPolicy value to set. - * @return the Metrics object itself. - */ - public Metrics retentionPolicy(RetentionPolicy retentionPolicy) { - this.retentionPolicy = retentionPolicy; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/PeekedMessageItem.java b/storage/client/src/main/java/com/azure/storage/queue/models/PeekedMessageItem.java deleted file mode 100644 index d86bdab8c2305..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/PeekedMessageItem.java +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * The object returned in the QueueMessageList array when calling Peek Messages - * on a Queue. - */ -@JacksonXmlRootElement(localName = "QueueMessage") -public final class PeekedMessageItem { - /* - * The Id of the Message. - */ - @JsonProperty(value = "MessageId", required = true) - private String messageId; - - /* - * The time the Message was inserted into the Queue. - */ - @JsonProperty(value = "InsertionTime", required = true) - private DateTimeRfc1123 insertionTime; - - /* - * The time that the Message will expire and be automatically deleted. - */ - @JsonProperty(value = "ExpirationTime", required = true) - private DateTimeRfc1123 expirationTime; - - /* - * The number of times the message has been dequeued. - */ - @JsonProperty(value = "DequeueCount", required = true) - private long dequeueCount; - - /* - * The content of the Message. - */ - @JsonProperty(value = "MessageText", required = true) - private String messageText; - - /** - * Get the messageId property: The Id of the Message. - * - * @return the messageId value. - */ - public String messageId() { - return this.messageId; - } - - /** - * Set the messageId property: The Id of the Message. - * - * @param messageId the messageId value to set. - * @return the PeekedMessageItem object itself. - */ - public PeekedMessageItem messageId(String messageId) { - this.messageId = messageId; - return this; - } - - /** - * Get the insertionTime property: The time the Message was inserted into - * the Queue. - * - * @return the insertionTime value. - */ - public OffsetDateTime insertionTime() { - if (this.insertionTime == null) { - return null; - } - return this.insertionTime.dateTime(); - } - - /** - * Set the insertionTime property: The time the Message was inserted into - * the Queue. - * - * @param insertionTime the insertionTime value to set. - * @return the PeekedMessageItem object itself. - */ - public PeekedMessageItem insertionTime(OffsetDateTime insertionTime) { - if (insertionTime == null) { - this.insertionTime = null; - } else { - this.insertionTime = new DateTimeRfc1123(insertionTime); - } - return this; - } - - /** - * Get the expirationTime property: The time that the Message will expire - * and be automatically deleted. - * - * @return the expirationTime value. - */ - public OffsetDateTime expirationTime() { - if (this.expirationTime == null) { - return null; - } - return this.expirationTime.dateTime(); - } - - /** - * Set the expirationTime property: The time that the Message will expire - * and be automatically deleted. - * - * @param expirationTime the expirationTime value to set. - * @return the PeekedMessageItem object itself. - */ - public PeekedMessageItem expirationTime(OffsetDateTime expirationTime) { - if (expirationTime == null) { - this.expirationTime = null; - } else { - this.expirationTime = new DateTimeRfc1123(expirationTime); - } - return this; - } - - /** - * Get the dequeueCount property: The number of times the message has been - * dequeued. - * - * @return the dequeueCount value. - */ - public long dequeueCount() { - return this.dequeueCount; - } - - /** - * Set the dequeueCount property: The number of times the message has been - * dequeued. - * - * @param dequeueCount the dequeueCount value to set. - * @return the PeekedMessageItem object itself. - */ - public PeekedMessageItem dequeueCount(long dequeueCount) { - this.dequeueCount = dequeueCount; - return this; - } - - /** - * Get the messageText property: The content of the Message. - * - * @return the messageText value. - */ - public String messageText() { - return this.messageText; - } - - /** - * Set the messageText property: The content of the Message. - * - * @param messageText the messageText value to set. - * @return the PeekedMessageItem object itself. - */ - public PeekedMessageItem messageText(String messageText) { - this.messageText = messageText; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/QueueCreateHeaders.java b/storage/client/src/main/java/com/azure/storage/queue/models/QueueCreateHeaders.java deleted file mode 100644 index 7e0bee9cd7eb4..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/QueueCreateHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Create operation. - */ -@JacksonXmlRootElement(localName = "Queue-Create-Headers") -public final class QueueCreateHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Queue service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the QueueCreateHeaders object itself. - */ - public QueueCreateHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the QueueCreateHeaders object itself. - */ - public QueueCreateHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the QueueCreateHeaders object itself. - */ - public QueueCreateHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the QueueCreateHeaders object itself. - */ - public QueueCreateHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/QueueDeleteHeaders.java b/storage/client/src/main/java/com/azure/storage/queue/models/QueueDeleteHeaders.java deleted file mode 100644 index 5a29a098628c2..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/QueueDeleteHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for Delete operation. - */ -@JacksonXmlRootElement(localName = "Queue-Delete-Headers") -public final class QueueDeleteHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Queue service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the QueueDeleteHeaders object itself. - */ - public QueueDeleteHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the QueueDeleteHeaders object itself. - */ - public QueueDeleteHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the QueueDeleteHeaders object itself. - */ - public QueueDeleteHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the QueueDeleteHeaders object itself. - */ - public QueueDeleteHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/QueueGetAccessPolicyHeaders.java b/storage/client/src/main/java/com/azure/storage/queue/models/QueueGetAccessPolicyHeaders.java deleted file mode 100644 index 65fa98edf8aa2..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/QueueGetAccessPolicyHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for GetAccessPolicy operation. - */ -@JacksonXmlRootElement(localName = "Queue-GetAccessPolicy-Headers") -public final class QueueGetAccessPolicyHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Queue service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the QueueGetAccessPolicyHeaders object itself. - */ - public QueueGetAccessPolicyHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the QueueGetAccessPolicyHeaders object itself. - */ - public QueueGetAccessPolicyHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the QueueGetAccessPolicyHeaders object itself. - */ - public QueueGetAccessPolicyHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the QueueGetAccessPolicyHeaders object itself. - */ - public QueueGetAccessPolicyHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/QueueGetPropertiesHeaders.java b/storage/client/src/main/java/com/azure/storage/queue/models/QueueGetPropertiesHeaders.java deleted file mode 100644 index 20286e8a0ddb3..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/QueueGetPropertiesHeaders.java +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.annotations.HeaderCollection; -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; -import java.util.Map; - -/** - * Defines headers for GetProperties operation. - */ -@JacksonXmlRootElement(localName = "Queue-GetProperties-Headers") -public final class QueueGetPropertiesHeaders { - /* - * The metadata property. - */ - @HeaderCollection("x-ms-meta-") - private Map metadata; - - /* - * The approximate number of messages in the queue. This number is not - * lower than the actual number of messages in the queue, but could be - * higher. - */ - @JsonProperty(value = "x-ms-approximate-messages-count") - private Integer approximateMessagesCount; - - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Queue service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the metadata property: The metadata property. - * - * @return the metadata value. - */ - public Map metadata() { - return this.metadata; - } - - /** - * Set the metadata property: The metadata property. - * - * @param metadata the metadata value to set. - * @return the QueueGetPropertiesHeaders object itself. - */ - public QueueGetPropertiesHeaders metadata(Map metadata) { - this.metadata = metadata; - return this; - } - - /** - * Get the approximateMessagesCount property: The approximate number of - * messages in the queue. This number is not lower than the actual number - * of messages in the queue, but could be higher. - * - * @return the approximateMessagesCount value. - */ - public Integer approximateMessagesCount() { - return this.approximateMessagesCount; - } - - /** - * Set the approximateMessagesCount property: The approximate number of - * messages in the queue. This number is not lower than the actual number - * of messages in the queue, but could be higher. - * - * @param approximateMessagesCount the approximateMessagesCount value to - * set. - * @return the QueueGetPropertiesHeaders object itself. - */ - public QueueGetPropertiesHeaders approximateMessagesCount(Integer approximateMessagesCount) { - this.approximateMessagesCount = approximateMessagesCount; - return this; - } - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the QueueGetPropertiesHeaders object itself. - */ - public QueueGetPropertiesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the QueueGetPropertiesHeaders object itself. - */ - public QueueGetPropertiesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the QueueGetPropertiesHeaders object itself. - */ - public QueueGetPropertiesHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the QueueGetPropertiesHeaders object itself. - */ - public QueueGetPropertiesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/QueueItem.java b/storage/client/src/main/java/com/azure/storage/queue/models/QueueItem.java deleted file mode 100644 index 1575af6babcb8..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/QueueItem.java +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.Map; - -/** - * An Azure Storage Queue. - */ -@JacksonXmlRootElement(localName = "Queue") -public final class QueueItem { - /* - * The name of the Queue. - */ - @JsonProperty(value = "Name", required = true) - private String name; - - /* - * The metadata property. - */ - @JsonProperty(value = "Metadata") - private Map metadata; - - /** - * Get the name property: The name of the Queue. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: The name of the Queue. - * - * @param name the name value to set. - * @return the QueueItem object itself. - */ - public QueueItem name(String name) { - this.name = name; - return this; - } - - /** - * Get the metadata property: The metadata property. - * - * @return the metadata value. - */ - public Map metadata() { - return this.metadata; - } - - /** - * Set the metadata property: The metadata property. - * - * @param metadata the metadata value to set. - * @return the QueueItem object itself. - */ - public QueueItem metadata(Map metadata) { - this.metadata = metadata; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/QueueMessage.java b/storage/client/src/main/java/com/azure/storage/queue/models/QueueMessage.java deleted file mode 100644 index 204825759ab0c..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/QueueMessage.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * A Message object which can be stored in a Queue. - */ -@JacksonXmlRootElement(localName = "QueueMessage") -public final class QueueMessage { - /* - * The content of the message - */ - @JsonProperty(value = "MessageText", required = true) - private String messageText; - - /** - * Get the messageText property: The content of the message. - * - * @return the messageText value. - */ - public String messageText() { - return this.messageText; - } - - /** - * Set the messageText property: The content of the message. - * - * @param messageText the messageText value to set. - * @return the QueueMessage object itself. - */ - public QueueMessage messageText(String messageText) { - this.messageText = messageText; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/QueueSetAccessPolicyHeaders.java b/storage/client/src/main/java/com/azure/storage/queue/models/QueueSetAccessPolicyHeaders.java deleted file mode 100644 index c2152ccc6a5cb..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/QueueSetAccessPolicyHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for SetAccessPolicy operation. - */ -@JacksonXmlRootElement(localName = "Queue-SetAccessPolicy-Headers") -public final class QueueSetAccessPolicyHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Queue service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the QueueSetAccessPolicyHeaders object itself. - */ - public QueueSetAccessPolicyHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the QueueSetAccessPolicyHeaders object itself. - */ - public QueueSetAccessPolicyHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the QueueSetAccessPolicyHeaders object itself. - */ - public QueueSetAccessPolicyHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the QueueSetAccessPolicyHeaders object itself. - */ - public QueueSetAccessPolicyHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/QueueSetMetadataHeaders.java b/storage/client/src/main/java/com/azure/storage/queue/models/QueueSetMetadataHeaders.java deleted file mode 100644 index f68e00835afaa..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/QueueSetMetadataHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for SetMetadata operation. - */ -@JacksonXmlRootElement(localName = "Queue-SetMetadata-Headers") -public final class QueueSetMetadataHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Queue service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the QueueSetMetadataHeaders object itself. - */ - public QueueSetMetadataHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the QueueSetMetadataHeaders object itself. - */ - public QueueSetMetadataHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the QueueSetMetadataHeaders object itself. - */ - public QueueSetMetadataHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the QueueSetMetadataHeaders object itself. - */ - public QueueSetMetadataHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/QueuesCreateResponse.java b/storage/client/src/main/java/com/azure/storage/queue/models/QueuesCreateResponse.java deleted file mode 100644 index b191cf79d5a0a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/QueuesCreateResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the create operation. - */ -public final class QueuesCreateResponse extends ResponseBase { - /** - * Creates an instance of QueuesCreateResponse. - * - * @param request the request which resulted in this QueuesCreateResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public QueuesCreateResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, QueueCreateHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/QueuesDeleteResponse.java b/storage/client/src/main/java/com/azure/storage/queue/models/QueuesDeleteResponse.java deleted file mode 100644 index 8023feab3bbe6..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/QueuesDeleteResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the delete operation. - */ -public final class QueuesDeleteResponse extends ResponseBase { - /** - * Creates an instance of QueuesDeleteResponse. - * - * @param request the request which resulted in this QueuesDeleteResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public QueuesDeleteResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, QueueDeleteHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/QueuesGetAccessPolicyResponse.java b/storage/client/src/main/java/com/azure/storage/queue/models/QueuesGetAccessPolicyResponse.java deleted file mode 100644 index d2fa4cc44c29e..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/QueuesGetAccessPolicyResponse.java +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; -import java.util.List; - -/** - * Contains all response data for the getAccessPolicy operation. - */ -public final class QueuesGetAccessPolicyResponse extends ResponseBase> { - /** - * Creates an instance of QueuesGetAccessPolicyResponse. - * - * @param request the request which resulted in this QueuesGetAccessPolicyResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public QueuesGetAccessPolicyResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, List value, QueueGetAccessPolicyHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public List value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/QueuesGetPropertiesResponse.java b/storage/client/src/main/java/com/azure/storage/queue/models/QueuesGetPropertiesResponse.java deleted file mode 100644 index 971f32275b2a7..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/QueuesGetPropertiesResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getProperties operation. - */ -public final class QueuesGetPropertiesResponse extends ResponseBase { - /** - * Creates an instance of QueuesGetPropertiesResponse. - * - * @param request the request which resulted in this QueuesGetPropertiesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public QueuesGetPropertiesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, QueueGetPropertiesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/QueuesSetAccessPolicyResponse.java b/storage/client/src/main/java/com/azure/storage/queue/models/QueuesSetAccessPolicyResponse.java deleted file mode 100644 index c1828b8668da5..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/QueuesSetAccessPolicyResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the setAccessPolicy operation. - */ -public final class QueuesSetAccessPolicyResponse extends ResponseBase { - /** - * Creates an instance of QueuesSetAccessPolicyResponse. - * - * @param request the request which resulted in this QueuesSetAccessPolicyResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public QueuesSetAccessPolicyResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, QueueSetAccessPolicyHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/QueuesSetMetadataResponse.java b/storage/client/src/main/java/com/azure/storage/queue/models/QueuesSetMetadataResponse.java deleted file mode 100644 index b33125bc20d6a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/QueuesSetMetadataResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the setMetadata operation. - */ -public final class QueuesSetMetadataResponse extends ResponseBase { - /** - * Creates an instance of QueuesSetMetadataResponse. - * - * @param request the request which resulted in this QueuesSetMetadataResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public QueuesSetMetadataResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, QueueSetMetadataHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/RetentionPolicy.java b/storage/client/src/main/java/com/azure/storage/queue/models/RetentionPolicy.java deleted file mode 100644 index 045580d2c31ad..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/RetentionPolicy.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * the retention policy. - */ -@JacksonXmlRootElement(localName = "RetentionPolicy") -public final class RetentionPolicy { - /* - * Indicates whether a retention policy is enabled for the storage service - */ - @JsonProperty(value = "Enabled", required = true) - private boolean enabled; - - /* - * Indicates the number of days that metrics or logging or soft-deleted - * data should be retained. All data older than this value will be deleted - */ - @JsonProperty(value = "Days") - private Integer days; - - /** - * Get the enabled property: Indicates whether a retention policy is - * enabled for the storage service. - * - * @return the enabled value. - */ - public boolean enabled() { - return this.enabled; - } - - /** - * Set the enabled property: Indicates whether a retention policy is - * enabled for the storage service. - * - * @param enabled the enabled value to set. - * @return the RetentionPolicy object itself. - */ - public RetentionPolicy enabled(boolean enabled) { - this.enabled = enabled; - return this; - } - - /** - * Get the days property: Indicates the number of days that metrics or - * logging or soft-deleted data should be retained. All data older than - * this value will be deleted. - * - * @return the days value. - */ - public Integer days() { - return this.days; - } - - /** - * Set the days property: Indicates the number of days that metrics or - * logging or soft-deleted data should be retained. All data older than - * this value will be deleted. - * - * @param days the days value to set. - * @return the RetentionPolicy object itself. - */ - public RetentionPolicy days(Integer days) { - this.days = days; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/ServiceGetPropertiesHeaders.java b/storage/client/src/main/java/com/azure/storage/queue/models/ServiceGetPropertiesHeaders.java deleted file mode 100644 index e58eab15aff92..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/ServiceGetPropertiesHeaders.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Defines headers for GetProperties operation. - */ -@JacksonXmlRootElement(localName = "Service-GetProperties-Headers") -public final class ServiceGetPropertiesHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Queue service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ServiceGetPropertiesHeaders object itself. - */ - public ServiceGetPropertiesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ServiceGetPropertiesHeaders object itself. - */ - public ServiceGetPropertiesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ServiceGetPropertiesHeaders object itself. - */ - public ServiceGetPropertiesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/ServiceGetStatisticsHeaders.java b/storage/client/src/main/java/com/azure/storage/queue/models/ServiceGetStatisticsHeaders.java deleted file mode 100644 index ac56fc0624e8d..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/ServiceGetStatisticsHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for GetStatistics operation. - */ -@JacksonXmlRootElement(localName = "Service-GetStatistics-Headers") -public final class ServiceGetStatisticsHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Queue service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ServiceGetStatisticsHeaders object itself. - */ - public ServiceGetStatisticsHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ServiceGetStatisticsHeaders object itself. - */ - public ServiceGetStatisticsHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ServiceGetStatisticsHeaders object itself. - */ - public ServiceGetStatisticsHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ServiceGetStatisticsHeaders object itself. - */ - public ServiceGetStatisticsHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/ServiceListQueuesSegmentHeaders.java b/storage/client/src/main/java/com/azure/storage/queue/models/ServiceListQueuesSegmentHeaders.java deleted file mode 100644 index 341fd32e50a97..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/ServiceListQueuesSegmentHeaders.java +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.implementation.DateTimeRfc1123; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.time.OffsetDateTime; - -/** - * Defines headers for ListQueuesSegment operation. - */ -@JacksonXmlRootElement(localName = "Service-ListQueuesSegment-Headers") -public final class ServiceListQueuesSegmentHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Queue service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * UTC date/time value generated by the service that indicates the time at - * which the response was initiated - */ - @JsonProperty(value = "Date") - private DateTimeRfc1123 dateProperty; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ServiceListQueuesSegmentHeaders object itself. - */ - public ServiceListQueuesSegmentHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ServiceListQueuesSegmentHeaders object itself. - */ - public ServiceListQueuesSegmentHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @return the dateProperty value. - */ - public OffsetDateTime dateProperty() { - if (this.dateProperty == null) { - return null; - } - return this.dateProperty.dateTime(); - } - - /** - * Set the dateProperty property: UTC date/time value generated by the - * service that indicates the time at which the response was initiated. - * - * @param dateProperty the dateProperty value to set. - * @return the ServiceListQueuesSegmentHeaders object itself. - */ - public ServiceListQueuesSegmentHeaders dateProperty(OffsetDateTime dateProperty) { - if (dateProperty == null) { - this.dateProperty = null; - } else { - this.dateProperty = new DateTimeRfc1123(dateProperty); - } - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ServiceListQueuesSegmentHeaders object itself. - */ - public ServiceListQueuesSegmentHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/ServiceSetPropertiesHeaders.java b/storage/client/src/main/java/com/azure/storage/queue/models/ServiceSetPropertiesHeaders.java deleted file mode 100644 index aa98c955afe48..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/ServiceSetPropertiesHeaders.java +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Defines headers for SetProperties operation. - */ -@JacksonXmlRootElement(localName = "Service-SetProperties-Headers") -public final class ServiceSetPropertiesHeaders { - /* - * This header uniquely identifies the request that was made and can be - * used for troubleshooting the request. - */ - @JsonProperty(value = "x-ms-request-id") - private String requestId; - - /* - * Indicates the version of the Queue service used to execute the request. - * This header is returned for requests made against version 2009-09-19 and - * above. - */ - @JsonProperty(value = "x-ms-version") - private String version; - - /* - * The errorCode property. - */ - @JsonProperty(value = "x-ms-error-code") - private String errorCode; - - /** - * Get the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @return the requestId value. - */ - public String requestId() { - return this.requestId; - } - - /** - * Set the requestId property: This header uniquely identifies the request - * that was made and can be used for troubleshooting the request. - * - * @param requestId the requestId value to set. - * @return the ServiceSetPropertiesHeaders object itself. - */ - public ServiceSetPropertiesHeaders requestId(String requestId) { - this.requestId = requestId; - return this; - } - - /** - * Get the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @return the version value. - */ - public String version() { - return this.version; - } - - /** - * Set the version property: Indicates the version of the Queue service - * used to execute the request. This header is returned for requests made - * against version 2009-09-19 and above. - * - * @param version the version value to set. - * @return the ServiceSetPropertiesHeaders object itself. - */ - public ServiceSetPropertiesHeaders version(String version) { - this.version = version; - return this; - } - - /** - * Get the errorCode property: The errorCode property. - * - * @return the errorCode value. - */ - public String errorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The errorCode property. - * - * @param errorCode the errorCode value to set. - * @return the ServiceSetPropertiesHeaders object itself. - */ - public ServiceSetPropertiesHeaders errorCode(String errorCode) { - this.errorCode = errorCode; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/ServicesGetPropertiesResponse.java b/storage/client/src/main/java/com/azure/storage/queue/models/ServicesGetPropertiesResponse.java deleted file mode 100644 index 7374eddcc1b66..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/ServicesGetPropertiesResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getProperties operation. - */ -public final class ServicesGetPropertiesResponse extends ResponseBase { - /** - * Creates an instance of ServicesGetPropertiesResponse. - * - * @param request the request which resulted in this ServicesGetPropertiesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ServicesGetPropertiesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, StorageServiceProperties value, ServiceGetPropertiesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public StorageServiceProperties value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/ServicesGetStatisticsResponse.java b/storage/client/src/main/java/com/azure/storage/queue/models/ServicesGetStatisticsResponse.java deleted file mode 100644 index 5c3538a95fec0..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/ServicesGetStatisticsResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the getStatistics operation. - */ -public final class ServicesGetStatisticsResponse extends ResponseBase { - /** - * Creates an instance of ServicesGetStatisticsResponse. - * - * @param request the request which resulted in this ServicesGetStatisticsResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ServicesGetStatisticsResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, StorageServiceStats value, ServiceGetStatisticsHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public StorageServiceStats value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/ServicesListQueuesSegmentResponse.java b/storage/client/src/main/java/com/azure/storage/queue/models/ServicesListQueuesSegmentResponse.java deleted file mode 100644 index e7bbf195f61bb..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/ServicesListQueuesSegmentResponse.java +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the listQueuesSegment operation. - */ -public final class ServicesListQueuesSegmentResponse extends ResponseBase { - /** - * Creates an instance of ServicesListQueuesSegmentResponse. - * - * @param request the request which resulted in this ServicesListQueuesSegmentResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ServicesListQueuesSegmentResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, ListQueuesSegmentResponse value, ServiceListQueuesSegmentHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } - - /** - * @return the deserialized response body. - */ - @Override - public ListQueuesSegmentResponse value() { - return super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/ServicesSetPropertiesResponse.java b/storage/client/src/main/java/com/azure/storage/queue/models/ServicesSetPropertiesResponse.java deleted file mode 100644 index 7086534101a95..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/ServicesSetPropertiesResponse.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.http.HttpHeaders; -import com.azure.core.http.HttpRequest; -import com.azure.core.http.rest.ResponseBase; - -/** - * Contains all response data for the setProperties operation. - */ -public final class ServicesSetPropertiesResponse extends ResponseBase { - /** - * Creates an instance of ServicesSetPropertiesResponse. - * - * @param request the request which resulted in this ServicesSetPropertiesResponse. - * @param statusCode the status code of the HTTP response. - * @param rawHeaders the raw headers of the HTTP response. - * @param value the deserialized value of the HTTP response. - * @param headers the deserialized headers of the HTTP response. - */ - public ServicesSetPropertiesResponse(HttpRequest request, int statusCode, HttpHeaders rawHeaders, Void value, ServiceSetPropertiesHeaders headers) { - super(request, statusCode, rawHeaders, value, headers); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/SignedIdentifier.java b/storage/client/src/main/java/com/azure/storage/queue/models/SignedIdentifier.java deleted file mode 100644 index 7764f3a25ea75..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/SignedIdentifier.java +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * signed identifier. - */ -@JacksonXmlRootElement(localName = "SignedIdentifier") -public final class SignedIdentifier { - /* - * a unique id - */ - @JsonProperty(value = "Id", required = true) - private String id; - - /* - * The access policy - */ - @JsonProperty(value = "AccessPolicy", required = true) - private AccessPolicy accessPolicy; - - /** - * Get the id property: a unique id. - * - * @return the id value. - */ - public String id() { - return this.id; - } - - /** - * Set the id property: a unique id. - * - * @param id the id value to set. - * @return the SignedIdentifier object itself. - */ - public SignedIdentifier id(String id) { - this.id = id; - return this; - } - - /** - * Get the accessPolicy property: The access policy. - * - * @return the accessPolicy value. - */ - public AccessPolicy accessPolicy() { - return this.accessPolicy; - } - - /** - * Set the accessPolicy property: The access policy. - * - * @param accessPolicy the accessPolicy value to set. - * @return the SignedIdentifier object itself. - */ - public SignedIdentifier accessPolicy(AccessPolicy accessPolicy) { - this.accessPolicy = accessPolicy; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/StorageError.java b/storage/client/src/main/java/com/azure/storage/queue/models/StorageError.java deleted file mode 100644 index 0e264e6da0b82..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/StorageError.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * The StorageError model. - */ -@JacksonXmlRootElement(localName = "StorageError") -public final class StorageError { - /* - * The message property. - */ - @JsonProperty(value = "Message") - private String message; - - /** - * Get the message property: The message property. - * - * @return the message value. - */ - public String message() { - return this.message; - } - - /** - * Set the message property: The message property. - * - * @param message the message value to set. - * @return the StorageError object itself. - */ - public StorageError message(String message) { - this.message = message; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/StorageErrorCode.java b/storage/client/src/main/java/com/azure/storage/queue/models/StorageErrorCode.java deleted file mode 100644 index dfa27d5fed947..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/StorageErrorCode.java +++ /dev/null @@ -1,287 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** - * Defines values for StorageErrorCode. - */ -public final class StorageErrorCode extends ExpandableStringEnum { - /** - * Static value AccountAlreadyExists for StorageErrorCode. - */ - public static final StorageErrorCode ACCOUNT_ALREADY_EXISTS = fromString("AccountAlreadyExists"); - - /** - * Static value AccountBeingCreated for StorageErrorCode. - */ - public static final StorageErrorCode ACCOUNT_BEING_CREATED = fromString("AccountBeingCreated"); - - /** - * Static value AccountIsDisabled for StorageErrorCode. - */ - public static final StorageErrorCode ACCOUNT_IS_DISABLED = fromString("AccountIsDisabled"); - - /** - * Static value AuthenticationFailed for StorageErrorCode. - */ - public static final StorageErrorCode AUTHENTICATION_FAILED = fromString("AuthenticationFailed"); - - /** - * Static value AuthorizationFailure for StorageErrorCode. - */ - public static final StorageErrorCode AUTHORIZATION_FAILURE = fromString("AuthorizationFailure"); - - /** - * Static value ConditionHeadersNotSupported for StorageErrorCode. - */ - public static final StorageErrorCode CONDITION_HEADERS_NOT_SUPPORTED = fromString("ConditionHeadersNotSupported"); - - /** - * Static value ConditionNotMet for StorageErrorCode. - */ - public static final StorageErrorCode CONDITION_NOT_MET = fromString("ConditionNotMet"); - - /** - * Static value EmptyMetadataKey for StorageErrorCode. - */ - public static final StorageErrorCode EMPTY_METADATA_KEY = fromString("EmptyMetadataKey"); - - /** - * Static value InsufficientAccountPermissions for StorageErrorCode. - */ - public static final StorageErrorCode INSUFFICIENT_ACCOUNT_PERMISSIONS = fromString("InsufficientAccountPermissions"); - - /** - * Static value InternalError for StorageErrorCode. - */ - public static final StorageErrorCode INTERNAL_ERROR = fromString("InternalError"); - - /** - * Static value InvalidAuthenticationInfo for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_AUTHENTICATION_INFO = fromString("InvalidAuthenticationInfo"); - - /** - * Static value InvalidHeaderValue for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_HEADER_VALUE = fromString("InvalidHeaderValue"); - - /** - * Static value InvalidHttpVerb for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_HTTP_VERB = fromString("InvalidHttpVerb"); - - /** - * Static value InvalidInput for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_INPUT = fromString("InvalidInput"); - - /** - * Static value InvalidMd5 for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_MD5 = fromString("InvalidMd5"); - - /** - * Static value InvalidMetadata for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_METADATA = fromString("InvalidMetadata"); - - /** - * Static value InvalidQueryParameterValue for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_QUERY_PARAMETER_VALUE = fromString("InvalidQueryParameterValue"); - - /** - * Static value InvalidRange for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_RANGE = fromString("InvalidRange"); - - /** - * Static value InvalidResourceName for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_RESOURCE_NAME = fromString("InvalidResourceName"); - - /** - * Static value InvalidUri for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_URI = fromString("InvalidUri"); - - /** - * Static value InvalidXmlDocument for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_XML_DOCUMENT = fromString("InvalidXmlDocument"); - - /** - * Static value InvalidXmlNodeValue for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_XML_NODE_VALUE = fromString("InvalidXmlNodeValue"); - - /** - * Static value Md5Mismatch for StorageErrorCode. - */ - public static final StorageErrorCode MD5MISMATCH = fromString("Md5Mismatch"); - - /** - * Static value MetadataTooLarge for StorageErrorCode. - */ - public static final StorageErrorCode METADATA_TOO_LARGE = fromString("MetadataTooLarge"); - - /** - * Static value MissingContentLengthHeader for StorageErrorCode. - */ - public static final StorageErrorCode MISSING_CONTENT_LENGTH_HEADER = fromString("MissingContentLengthHeader"); - - /** - * Static value MissingRequiredQueryParameter for StorageErrorCode. - */ - public static final StorageErrorCode MISSING_REQUIRED_QUERY_PARAMETER = fromString("MissingRequiredQueryParameter"); - - /** - * Static value MissingRequiredHeader for StorageErrorCode. - */ - public static final StorageErrorCode MISSING_REQUIRED_HEADER = fromString("MissingRequiredHeader"); - - /** - * Static value MissingRequiredXmlNode for StorageErrorCode. - */ - public static final StorageErrorCode MISSING_REQUIRED_XML_NODE = fromString("MissingRequiredXmlNode"); - - /** - * Static value MultipleConditionHeadersNotSupported for StorageErrorCode. - */ - public static final StorageErrorCode MULTIPLE_CONDITION_HEADERS_NOT_SUPPORTED = fromString("MultipleConditionHeadersNotSupported"); - - /** - * Static value OperationTimedOut for StorageErrorCode. - */ - public static final StorageErrorCode OPERATION_TIMED_OUT = fromString("OperationTimedOut"); - - /** - * Static value OutOfRangeInput for StorageErrorCode. - */ - public static final StorageErrorCode OUT_OF_RANGE_INPUT = fromString("OutOfRangeInput"); - - /** - * Static value OutOfRangeQueryParameterValue for StorageErrorCode. - */ - public static final StorageErrorCode OUT_OF_RANGE_QUERY_PARAMETER_VALUE = fromString("OutOfRangeQueryParameterValue"); - - /** - * Static value RequestBodyTooLarge for StorageErrorCode. - */ - public static final StorageErrorCode REQUEST_BODY_TOO_LARGE = fromString("RequestBodyTooLarge"); - - /** - * Static value ResourceTypeMismatch for StorageErrorCode. - */ - public static final StorageErrorCode RESOURCE_TYPE_MISMATCH = fromString("ResourceTypeMismatch"); - - /** - * Static value RequestUrlFailedToParse for StorageErrorCode. - */ - public static final StorageErrorCode REQUEST_URL_FAILED_TO_PARSE = fromString("RequestUrlFailedToParse"); - - /** - * Static value ResourceAlreadyExists for StorageErrorCode. - */ - public static final StorageErrorCode RESOURCE_ALREADY_EXISTS = fromString("ResourceAlreadyExists"); - - /** - * Static value ResourceNotFound for StorageErrorCode. - */ - public static final StorageErrorCode RESOURCE_NOT_FOUND = fromString("ResourceNotFound"); - - /** - * Static value ServerBusy for StorageErrorCode. - */ - public static final StorageErrorCode SERVER_BUSY = fromString("ServerBusy"); - - /** - * Static value UnsupportedHeader for StorageErrorCode. - */ - public static final StorageErrorCode UNSUPPORTED_HEADER = fromString("UnsupportedHeader"); - - /** - * Static value UnsupportedXmlNode for StorageErrorCode. - */ - public static final StorageErrorCode UNSUPPORTED_XML_NODE = fromString("UnsupportedXmlNode"); - - /** - * Static value UnsupportedQueryParameter for StorageErrorCode. - */ - public static final StorageErrorCode UNSUPPORTED_QUERY_PARAMETER = fromString("UnsupportedQueryParameter"); - - /** - * Static value UnsupportedHttpVerb for StorageErrorCode. - */ - public static final StorageErrorCode UNSUPPORTED_HTTP_VERB = fromString("UnsupportedHttpVerb"); - - /** - * Static value InvalidMarker for StorageErrorCode. - */ - public static final StorageErrorCode INVALID_MARKER = fromString("InvalidMarker"); - - /** - * Static value MessageNotFound for StorageErrorCode. - */ - public static final StorageErrorCode MESSAGE_NOT_FOUND = fromString("MessageNotFound"); - - /** - * Static value MessageTooLarge for StorageErrorCode. - */ - public static final StorageErrorCode MESSAGE_TOO_LARGE = fromString("MessageTooLarge"); - - /** - * Static value PopReceiptMismatch for StorageErrorCode. - */ - public static final StorageErrorCode POP_RECEIPT_MISMATCH = fromString("PopReceiptMismatch"); - - /** - * Static value QueueAlreadyExists for StorageErrorCode. - */ - public static final StorageErrorCode QUEUE_ALREADY_EXISTS = fromString("QueueAlreadyExists"); - - /** - * Static value QueueBeingDeleted for StorageErrorCode. - */ - public static final StorageErrorCode QUEUE_BEING_DELETED = fromString("QueueBeingDeleted"); - - /** - * Static value QueueDisabled for StorageErrorCode. - */ - public static final StorageErrorCode QUEUE_DISABLED = fromString("QueueDisabled"); - - /** - * Static value QueueNotEmpty for StorageErrorCode. - */ - public static final StorageErrorCode QUEUE_NOT_EMPTY = fromString("QueueNotEmpty"); - - /** - * Static value QueueNotFound for StorageErrorCode. - */ - public static final StorageErrorCode QUEUE_NOT_FOUND = fromString("QueueNotFound"); - - /** - * Creates or finds a StorageErrorCode from its string representation. - * - * @param name a name to look for. - * @return the corresponding StorageErrorCode. - */ - @JsonCreator - public static StorageErrorCode fromString(String name) { - return fromString(name, StorageErrorCode.class); - } - - /** - * @return known StorageErrorCode values. - */ - public static Collection values() { - return values(StorageErrorCode.class); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/StorageErrorException.java b/storage/client/src/main/java/com/azure/storage/queue/models/StorageErrorException.java deleted file mode 100644 index 2459f69111692..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/StorageErrorException.java +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.azure.core.exception.HttpResponseException; -import com.azure.core.http.HttpResponse; - -/** - * Exception thrown for an invalid response with StorageError information. - */ -public final class StorageErrorException extends HttpResponseException { - /** - * Initializes a new instance of the StorageErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - */ - public StorageErrorException(String message, HttpResponse response) { - super(message, response); - } - - /** - * Initializes a new instance of the StorageErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - * @param value the deserialized response value. - */ - public StorageErrorException(String message, HttpResponse response, StorageError value) { - super(message, response, value); - } - - @Override - public StorageError value() { - return (StorageError) super.value(); - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/StorageServiceProperties.java b/storage/client/src/main/java/com/azure/storage/queue/models/StorageServiceProperties.java deleted file mode 100644 index e13cbde9e5cfb..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/StorageServiceProperties.java +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import java.util.ArrayList; -import java.util.List; - -/** - * Storage Service Properties. - */ -@JacksonXmlRootElement(localName = "StorageServiceProperties") -public final class StorageServiceProperties { - /* - * Azure Analytics Logging settings - */ - @JsonProperty(value = "Logging") - private Logging logging; - - /* - * A summary of request statistics grouped by API in hourly aggregates for - * queues - */ - @JsonProperty(value = "HourMetrics") - private Metrics hourMetrics; - - /* - * a summary of request statistics grouped by API in minute aggregates for - * queues - */ - @JsonProperty(value = "MinuteMetrics") - private Metrics minuteMetrics; - - private static final class CorsWrapper { - @JacksonXmlProperty(localName = "CorsRule") - private final List items; - - @JsonCreator - private CorsWrapper(@JacksonXmlProperty(localName = "CorsRule") List items) { - this.items = items; - } - } - - /* - * The set of CORS rules. - */ - @JsonProperty(value = "Cors") - private CorsWrapper cors; - - /** - * Get the logging property: Azure Analytics Logging settings. - * - * @return the logging value. - */ - public Logging logging() { - return this.logging; - } - - /** - * Set the logging property: Azure Analytics Logging settings. - * - * @param logging the logging value to set. - * @return the StorageServiceProperties object itself. - */ - public StorageServiceProperties logging(Logging logging) { - this.logging = logging; - return this; - } - - /** - * Get the hourMetrics property: A summary of request statistics grouped by - * API in hourly aggregates for queues. - * - * @return the hourMetrics value. - */ - public Metrics hourMetrics() { - return this.hourMetrics; - } - - /** - * Set the hourMetrics property: A summary of request statistics grouped by - * API in hourly aggregates for queues. - * - * @param hourMetrics the hourMetrics value to set. - * @return the StorageServiceProperties object itself. - */ - public StorageServiceProperties hourMetrics(Metrics hourMetrics) { - this.hourMetrics = hourMetrics; - return this; - } - - /** - * Get the minuteMetrics property: a summary of request statistics grouped - * by API in minute aggregates for queues. - * - * @return the minuteMetrics value. - */ - public Metrics minuteMetrics() { - return this.minuteMetrics; - } - - /** - * Set the minuteMetrics property: a summary of request statistics grouped - * by API in minute aggregates for queues. - * - * @param minuteMetrics the minuteMetrics value to set. - * @return the StorageServiceProperties object itself. - */ - public StorageServiceProperties minuteMetrics(Metrics minuteMetrics) { - this.minuteMetrics = minuteMetrics; - return this; - } - - /** - * Get the cors property: The set of CORS rules. - * - * @return the cors value. - */ - public List cors() { - if (this.cors == null) { - this.cors = new CorsWrapper(new ArrayList()); - } - return this.cors.items; - } - - /** - * Set the cors property: The set of CORS rules. - * - * @param cors the cors value to set. - * @return the StorageServiceProperties object itself. - */ - public StorageServiceProperties cors(List cors) { - this.cors = new CorsWrapper(cors); - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/StorageServiceStats.java b/storage/client/src/main/java/com/azure/storage/queue/models/StorageServiceStats.java deleted file mode 100644 index d70c794bda65a..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/StorageServiceStats.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.queue.models; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -/** - * Stats for the storage service. - */ -@JacksonXmlRootElement(localName = "StorageServiceStats") -public final class StorageServiceStats { - /* - * Geo-Replication information for the Secondary Storage Service - */ - @JsonProperty(value = "GeoReplication") - private GeoReplication geoReplication; - - /** - * Get the geoReplication property: Geo-Replication information for the - * Secondary Storage Service. - * - * @return the geoReplication value. - */ - public GeoReplication geoReplication() { - return this.geoReplication; - } - - /** - * Set the geoReplication property: Geo-Replication information for the - * Secondary Storage Service. - * - * @param geoReplication the geoReplication value to set. - * @return the StorageServiceStats object itself. - */ - public StorageServiceStats geoReplication(GeoReplication geoReplication) { - this.geoReplication = geoReplication; - return this; - } -} diff --git a/storage/client/src/main/java/com/azure/storage/queue/models/package-info.java b/storage/client/src/main/java/com/azure/storage/queue/models/package-info.java deleted file mode 100644 index 92606a7993c12..0000000000000 --- a/storage/client/src/main/java/com/azure/storage/queue/models/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -/** - * This package contains the data models for AzureQueueStorage. - */ -package com.azure.storage.queue.models; diff --git a/storage/client/src/test/java/com/azure/storage/blob/BlobPocTests.java b/storage/client/src/test/java/com/azure/storage/blob/BlobPocTests.java deleted file mode 100644 index f6a67ae41f651..0000000000000 --- a/storage/client/src/test/java/com/azure/storage/blob/BlobPocTests.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.storage.blob; - -import com.azure.core.http.HttpClient; -import com.azure.core.http.HttpPipeline; -import com.azure.core.http.ProxyOptions; -import com.azure.core.http.ProxyOptions.Type; -import com.azure.storage.blob.implementation.AzureBlobStorageBuilder; -import com.azure.storage.blob.implementation.AzureBlobStorageImpl; -import com.azure.storage.blob.models.BlobsGetPropertiesResponse; -import com.azure.storage.blob.models.BlockLookupList; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; -import java.net.InetSocketAddress; -import java.nio.charset.StandardCharsets; -import java.util.Arrays; -import java.util.Collections; -import java.util.Random; -import org.apache.commons.codec.binary.Base64; -import reactor.core.publisher.Flux; - -public class BlobPocTests { - - //@Test - public void testCreateBlob() { - AzureBlobStorageImpl client = new AzureBlobStorageBuilder().pipeline(HttpPipeline.builder().httpClient(HttpClient.createDefault().proxy(() -> new ProxyOptions(Type.HTTP, new InetSocketAddress("localhost", 8888)))).build()).url("https://" + System.getenv("AZURE_STORAGE_ACCOUNT_NAME") + ".blob.core.windows.net/mycontainer/random223" + System.getenv("AZURE_STORAGE_SAS_TOKEN")).build(); - /*, - new HttpPipelinePolicy() { - @Override - public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { - String getDirectoryUrl = context.httpRequest().getDirectoryUrl().toString(); - String sasToken = System.getenv("AZURE_STORAGE_SAS_TOKEN"); - if (getDirectoryUrl.contains("?")) { - sasToken = sasToken.replaceFirst("\\?", "&"); - } - getDirectoryUrl += sasToken; - try { - context.withHttpRequest(context.httpRequest().withUrl(new URL(getDirectoryUrl))); - } catch (MalformedURLException e) { - return Mono.error(e); - } - return next.process(); - } - }*/; - - Random random = new Random(); - - byte[] randomBytes = new byte[4096]; - random.nextBytes(randomBytes); - ByteBuf bb = Unpooled.wrappedBuffer(randomBytes); - String base64 = Base64.encodeBase64String("0001".getBytes(StandardCharsets.UTF_8)); - client.blockBlobs().stageBlockWithRestResponseAsync(null, null, base64, 4096, Flux.just(bb), null).block(); - client.blockBlobs().commitBlockListWithRestResponseAsync(null, null, new BlockLookupList().latest(Arrays.asList(base64)), null).block(); - - client.blobs().setMetadataWithRestResponseAsync(null, null, null, Collections.singletonMap("foo", "bar"), null, null, null, null, null, null, null).block(); - BlobsGetPropertiesResponse res = client.blobs().getPropertiesWithRestResponseAsync(null, null, null).block(); - System.out.println(res.deserializedHeaders().metadata().size()); - } -}