ShareClient Class
Definition
- java.lang.Object
- com.azure.storage.file.share.ShareClient
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 = new ShareClientBuilder()
.connectionString("${connectionString}")
.endpoint("${endpoint}")
.buildClient();
View ShareClientBuilder for additional ways to construct the client.
public class ShareClient
Methods
| create() |
Creates the share in the storage account. Code Samples Create the share
For more information, see the Azure Docs. |
| createDirectory(String directoryName) |
Creates the directory in the share with the given name. Code Samples Create the directory "documents"
For more information, see the Azure Docs. |
| createDirectoryWithResponse(String directoryName, FileSmbProperties smbProperties, String filePermission, Map<String,String> metadata, Duration timeout, Context context) |
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"
For more information, see the Azure Docs. |
| createFile(String fileName, long maxSize) |
Creates the file in the share with the given name and file max size. Code Samples Create the file "myfile" with size of 1024 bytes.
For more information, see the Azure Docs. |
| createFileWithResponse(String fileName, long maxSize, ShareFileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Map<String,String> metadata, ShareRequestConditions requestConditions, Duration timeout, Context context) |
Creates the file in the share with the given name, file max size and associates the passed properties to it. Code Samples Create the file "myfile" with length of 1024 bytes, some headers, file smb properties and metadata
For more information, see the Azure Docs. |
| createFileWithResponse(String fileName, long maxSize, ShareFileHttpHeaders httpHeaders, FileSmbProperties smbProperties, String filePermission, Map<String,String> metadata, Duration timeout, Context context) |
Creates the file in the share with the given name, file max size and associates the passed properties to it. Code Samples Create the file "myfile" with length of 1024 bytes, some headers, file smb properties and metadata
For more information, see the Azure Docs. |
| createPermission(String filePermission) |
Creates a permission at the share level. If a permission already exists, it returns the key of it, else creates a new permission and returns the key. Code Samples
|
| createPermissionWithResponse(String filePermission, Context context) |
Creates a permission t the share level. If a permission already exists, it returns the key of it, else creates a new permission and returns the key. Code Samples
|
| createSnapshot() |
Creates a snapshot of the share with the same metadata associated to the share at the time of creation. Code Samples Create a snapshot
For more information, see the Azure Docs. |
| createSnapshotWithResponse(Map<String,String> metadata, Duration timeout, Context context) |
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"
For more information, see the Azure Docs. |
| createWithResponse(ShareCreateOptions options, Duration timeout, Context context) |
Creates the share in the storage account with the specified options. Code Samples
For more information, see the Azure Docs. |
| createWithResponse(Map<String,String> metadata, Integer quotaInGB, Duration timeout, Context context) |
Creates the share in the storage account with the specified metadata and quota. Code Samples Create the share with metadata "share:metadata"
Create the share with a quota of 10 GB
For more information, see the Azure Docs. |
| delete() |
Deletes the share in the storage account Code Samples Delete the share
For more information, see the Azure Docs. |
| deleteDirectory(String directoryName) |
Deletes the specified directory in the share. Code Samples Delete the directory "mydirectory"
For more information, see the Azure Docs. |
| deleteDirectoryWithResponse(String directoryName, Duration timeout, Context context) |
Deletes the specified directory in the share. Code Samples Delete the directory "mydirectory"
For more information, see the Azure Docs. |
| deleteFile(String fileName) |
Deletes the specified file in the share. Code Samples Delete the file "myfile"
For more information, see the Azure Docs. |
| deleteFileWithResponse(String fileName, ShareRequestConditions requestConditions, Duration timeout, Context context) |
Deletes the specified file in the share. Code Samples Delete the file "myfile"
For more information, see the Azure Docs. |
| deleteFileWithResponse(String fileName, Duration timeout, Context context) |
Deletes the specified file in the share. Code Samples Delete the file "myfile"
For more information, see the Azure Docs. |
| deleteWithResponse(ShareDeleteOptions options, Duration timeout, Context context) |
Deletes the share in the storage account Code Samples Delete the share
For more information, see the Azure Docs. |
| deleteWithResponse(Duration timeout, Context context) |
Deletes the share in the storage account Code Samples Delete the share
For more information, see the Azure Docs. |
| exists() |
Determines if the share this client represents exists in the cloud. Code Samples
|
| existsWithResponse(Duration timeout, Context context) |
Determines if the share this client represents exists in the cloud. Code Samples
|
| generateSas(ShareServiceSasSignatureValues shareServiceSasSignatureValues) |
Generates a service sas for the queue using the specified ShareServiceSasSignatureValues Note : The client must be authenticated via StorageSharedKeyCredential See ShareServiceSasSignatureValues for more information on how to construct a service SAS. Code Samples
|
| generateSas(ShareServiceSasSignatureValues shareServiceSasSignatureValues, Context context) |
Generates a service sas for the queue using the specified ShareServiceSasSignatureValues Note : The client must be authenticated via StorageSharedKeyCredential See ShareServiceSasSignatureValues for more information on how to construct a service SAS. Code Samples
|
| getAccessPolicy() |
Retrieves stored access policies specified for the share. Code Samples List the stored access policies
For more information, see the Azure Docs. |
| getAccessPolicy(ShareGetAccessPolicyOptions options) |
Retrieves stored access policies specified for the share. Code Samples List the stored access policies
For more information, see the Azure Docs. |
| getAccountName() |
Get associated account name. |
| getAccountUrl() |
Get the url of the storage account. |
| getDirectoryClient(String directoryName) |
Constructs a ShareDirectoryClient that interacts with the specified directory. If the directory doesn't exist in the share create() in the client will need to be called before interaction with the directory can happen. |
| getFileClient(String filePath) |
Constructs a ShareFileClient that interacts with the specified file. If the file doesn't exist in the share create(long maxSize) ) create} in the client will need to be called before interaction with the file can happen. |
| getHttpPipeline() |
Gets the HttpPipeline powering this client. |
| getPermission(String filePermissionKey) |
Gets a permission for a given key Code Samples
|
| getPermissionWithResponse(String filePermissionKey, Context context) |
Gets a permission for a given key. Code Samples
|
| getProperties() |
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
For more information, see the Azure Docs. |
| getPropertiesWithResponse(ShareGetPropertiesOptions options, Duration timeout, Context context) |
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
For more information, see the Azure Docs. |
| getPropertiesWithResponse(Duration timeout, Context context) |
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
For more information, see the Azure Docs. |
| getRootDirectoryClient() |
Constructs a ShareDirectoryClient that interacts with the root directory in the share. If the directory doesn't exist in the share create() in the client will need to be called before interaction with the directory can happen. |
| getServiceVersion() |
Gets the service version the client is using. |
| getShareName() |
Get share name from share client. Code Samples
|
| getShareUrl() |
Get the url of the storage share client. |
| getSnapshotClient(String snapshot) |
Creates a new ShareAsyncClient linked to the |
| getSnapshotId() |
Get snapshot id which attached to ShareClient. Return Code Samples Get the share snapshot id.
|
| getStatistics() |
Retrieves storage statistics about the share. Code Samples Retrieve the storage statistics
For more information, see the Azure Docs. |
| getStatisticsWithResponse(ShareGetStatisticsOptions options, Duration timeout, Context context) |
Retrieves storage statistics about the share. Code Samples Retrieve the storage statistics
For more information, see the Azure Docs. |
| getStatisticsWithResponse(Duration timeout, Context context) |
Retrieves storage statistics about the share. Code Samples Retrieve the storage statistics
For more information, see the Azure Docs. |
| setAccessPolicy(List<ShareSignedIdentifier> permissions) |
Sets stored access policies for the share. Code Samples Set a read only stored access policy
For more information, see the Azure Docs. |
| setAccessPolicyWithResponse(ShareSetAccessPolicyOptions options, Duration timeout, Context context) |
Sets stored access policies for the share. Code Samples Set a read only stored access policy
For more information, see the Azure Docs. |
| setAccessPolicyWithResponse(List<ShareSignedIdentifier> permissions, Duration timeout, Context context) |
Sets stored access policies for the share. Code Samples Set a read only stored access policy
For more information, see the Azure Docs. |
| setMetadata(Map<String,String> metadata) |
Sets the user-defined metadata to associate to the share. If Code Samples Set the metadata to "share:updatedMetadata"
Clear the metadata of the share
For more information, see the Azure Docs. |
| setMetadataWithResponse(ShareSetMetadataOptions options, Duration timeout, Context context) |
Sets the user-defined metadata to associate to the share. If Code Samples Set the metadata to "share:updatedMetadata"
For more information, see the Azure Docs. |
| setMetadataWithResponse(Map<String,String> metadata, Duration timeout, Context context) |
Sets the user-defined metadata to associate to the share. If Code Samples Set the metadata to "share:updatedMetadata"
For more information, see the Azure Docs. |
| setProperties(ShareSetPropertiesOptions options) |
Sets the share's properties. Code Samples
For more information, see the Azure Docs. |
| setPropertiesWithResponse(ShareSetPropertiesOptions options, Duration timeout, Context context) |
Sets the share's properties. Code Samples
For more information, see the Azure Docs. |
| setQuota(int quotaInGB) |
Sets the maximum size in GB that the share is allowed to grow. Code Samples Set the quota to 1024 GB
For more information, see the Azure Docs. Deprecated. Use setProperties(ShareSetPropertiesOptions options) |
| setQuotaWithResponse(int quotaInGB, Duration timeout, Context context) |
Sets the maximum size in GB that the share is allowed to grow. Code Samples Set the quota to 1024 GB
For more information, see the Azure Docs. Deprecated. Use setPropertiesWithResponse(ShareSetPropertiesOptions options, Duration timeout, Context context) |