Loading [MathJax]/extensions/tex2jax.js
azure-storage-files-shares
All Classes Functions Variables Pages
share_file_client.hpp
1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4#pragma once
5
6#include "azure/storage/files/shares/share_client.hpp"
7#include "azure/storage/files/shares/share_directory_client.hpp"
8#include "azure/storage/files/shares/share_options.hpp"
9#include "azure/storage/files/shares/share_responses.hpp"
10
11#include <azure/core/internal/http/pipeline.hpp>
12#include <azure/core/response.hpp>
13#include <azure/storage/common/storage_credential.hpp>
14
15#include <memory>
16#include <string>
17
18namespace Azure { namespace Storage { namespace Files { namespace Shares {
19
24 class ShareFileClient final {
25 public:
36 const std::string& connectionString,
37 const std::string& shareName,
38 const std::string& fileName,
39 const ShareClientOptions& options = ShareClientOptions());
40
48 const std::string& shareFileUrl,
49 std::shared_ptr<StorageSharedKeyCredential> credential,
50 const ShareClientOptions& options = ShareClientOptions());
51
59 const std::string& shareFileUrl,
60 std::shared_ptr<Core::Credentials::TokenCredential> credential,
61 const ShareClientOptions& options = ShareClientOptions());
62
70 const std::string& shareFileUrl,
71 const ShareClientOptions& options = ShareClientOptions());
72
78 std::string GetUrl() const { return m_shareFileUrl.GetAbsoluteUrl(); }
79
89 ShareFileClient WithShareSnapshot(const std::string& shareSnapshot) const;
90
99 Azure::Response<Models::CreateFileResult> Create(
100 int64_t fileSize,
101 const CreateFileOptions& options = CreateFileOptions(),
102 const Azure::Core::Context& context = Azure::Core::Context()) const;
103
111 Azure::Response<Models::DeleteFileResult> Delete(
112 const DeleteFileOptions& options = DeleteFileOptions(),
113 const Azure::Core::Context& context = Azure::Core::Context()) const;
114
122 Azure::Response<Models::DeleteFileResult> DeleteIfExists(
123 const DeleteFileOptions& options = DeleteFileOptions(),
124 const Azure::Core::Context& context = Azure::Core::Context()) const;
125
134 Azure::Response<Models::DownloadFileResult> Download(
135 const DownloadFileOptions& options = DownloadFileOptions(),
136 const Azure::Core::Context& context = Azure::Core::Context()) const;
137
150 Azure::Response<Models::DownloadFileToResult> DownloadTo(
151 uint8_t* buffer,
152 size_t bufferSize,
154 const Azure::Core::Context& context = Azure::Core::Context()) const;
155
166 Azure::Response<Models::DownloadFileToResult> DownloadTo(
167 const std::string& fileName,
169 const Azure::Core::Context& context = Azure::Core::Context()) const;
170
182 Azure::Response<Models::UploadFileFromResult> UploadFrom(
183 const uint8_t* buffer,
184 size_t bufferSize,
186 const Azure::Core::Context& context = Azure::Core::Context()) const;
187
198 Azure::Response<Models::UploadFileFromResult> UploadFrom(
199 const std::string& fileName,
201 const Azure::Core::Context& context = Azure::Core::Context()) const;
202
217 std::string copySource,
219 const Azure::Core::Context& context = Azure::Core::Context()) const;
220
230 Azure::Response<Models::AbortFileCopyResult> AbortCopy(
231 std::string copyId,
233 const Azure::Core::Context& context = Azure::Core::Context()) const;
234
242 Azure::Response<Models::FileProperties> GetProperties(
244 const Azure::Core::Context& context = Azure::Core::Context()) const;
245
255 Azure::Response<Models::SetFilePropertiesResult> SetProperties(
256 const Models::FileHttpHeaders& httpHeaders,
257 const Models::FileSmbProperties& smbProperties,
259 const Azure::Core::Context& context = Azure::Core::Context()) const;
260
270 Azure::Response<Models::SetFileMetadataResult> SetMetadata(
271 Storage::Metadata metadata,
273 const Azure::Core::Context& context = Azure::Core::Context()) const;
274
284 Azure::Response<Models::UploadFileRangeResult> UploadRange(
285 int64_t offset,
286 Azure::Core::IO::BodyStream& content,
288 const Azure::Core::Context& context = Azure::Core::Context()) const;
289
299 Azure::Response<Models::ClearFileRangeResult> ClearRange(
300 int64_t offset,
301 int64_t length,
303 const Azure::Core::Context& context = Azure::Core::Context()) const;
304
312 Azure::Response<Models::GetFileRangeListResult> GetRangeList(
314 const Azure::Core::Context& context = Azure::Core::Context()) const;
315
325 Azure::Response<Models::GetFileRangeListResult> GetRangeListDiff(
326 std::string previousShareSnapshot,
328 const Azure::Core::Context& context = Azure::Core::Context()) const;
329
339 const Azure::Core::Context& context = Azure::Core::Context()) const;
340
349 Azure::Response<Models::ForceCloseFileHandleResult> ForceCloseHandle(
350 const std::string& handleId,
352 const Azure::Core::Context& context = Azure::Core::Context()) const;
353
363 const Azure::Core::Context& context = Azure::Core::Context()) const;
364
375 Azure::Response<Models::UploadFileRangeFromUriResult> UploadRangeFromUri(
376 int64_t destinationOffset,
377 const std::string& sourceUri,
378 const Azure::Core::Http::HttpRange& sourceRange,
380 const Azure::Core::Context& context = Azure::Core::Context()) const;
381
390 Azure::Response<Models::CreateFileHardLinkResult> CreateHardLink(
391 const std::string& targetFile,
393 const Azure::Core::Context& context = Azure::Core::Context()) const;
394
395 private:
396 Azure::Core::Url m_shareFileUrl;
397 std::shared_ptr<Azure::Core::Http::_internal::HttpPipeline> m_pipeline;
398 Nullable<bool> m_allowTrailingDot;
399 Nullable<bool> m_allowSourceTrailingDot;
400 Nullable<Models::ShareTokenIntent> m_shareTokenIntent;
401
402 explicit ShareFileClient(
403 Azure::Core::Url shareFileUrl,
404 std::shared_ptr<Azure::Core::Http::_internal::HttpPipeline> pipeline)
405 : m_shareFileUrl(std::move(shareFileUrl)), m_pipeline(std::move(pipeline))
406 {
407 }
408
409 friend class ShareClient;
410 friend class ShareDirectoryClient;
411 friend class ShareLeaseClient;
412 };
413}}}} // namespace Azure::Storage::Files::Shares
Response type for Azure::Storage::Files::Shares::ShareFileClient::ForceCloseAllHandles.
Definition share_responses.hpp:865
Response type for Azure::Storage::Files::Shares::ShareFileClient::ListHandles.
Definition share_responses.hpp:844
The ShareClient allows you to manipulate Azure Storage shares and their directories and files.
Definition share_client.hpp:24
The ShareDirectoryClient allows you to manipulate Azure Storage shares and their directories and file...
Definition share_directory_client.hpp:25
The ShareFileClient allows you to manipulate Azure Storage shares and their directories and files.
Definition share_file_client.hpp:24
Azure::Response< Models::DeleteFileResult > DeleteIfExists(const DeleteFileOptions &options=DeleteFileOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Deletes the file if it exists.
ShareFileClient(const std::string &shareFileUrl, const ShareClientOptions &options=ShareClientOptions())
Initialize a new instance of ShareFileClient using anonymous access or shared access signature.
Azure::Response< Models::ClearFileRangeResult > ClearRange(int64_t offset, int64_t length, const ClearFileRangeOptions &options=ClearFileRangeOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Clears some range of data within the file.
Azure::Response< Models::UploadFileRangeResult > UploadRange(int64_t offset, Azure::Core::IO::BodyStream &content, const UploadFileRangeOptions &options=UploadFileRangeOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Uploads some data to a range of the file.
Azure::Response< Models::GetFileRangeListResult > GetRangeList(const GetFileRangeListOptions &options=GetFileRangeListOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Gets the list of valid range from the file within specified range.
Azure::Response< Models::FileProperties > GetProperties(const GetFilePropertiesOptions &options=GetFilePropertiesOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Gets the properties of a file.
Azure::Response< Models::DownloadFileToResult > DownloadTo(uint8_t *buffer, size_t bufferSize, const DownloadFileToOptions &options=DownloadFileToOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Downloads a file or a file range from the service to a memory buffer using parallel requests.
Azure::Response< Models::DownloadFileResult > Download(const DownloadFileOptions &options=DownloadFileOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Open a stream for the file's content, or a range of the file's content that can be used to download t...
Azure::Response< Models::SetFileMetadataResult > SetMetadata(Storage::Metadata metadata, const SetFileMetadataOptions &options=SetFileMetadataOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Sets the metadata of the file.
ShareFileClient WithShareSnapshot(const std::string &shareSnapshot) const
Initializes a new instance of the ShareFileClient class with an identical URL source but the specifie...
Azure::Response< Models::DownloadFileToResult > DownloadTo(const std::string &fileName, const DownloadFileToOptions &options=DownloadFileToOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Downloads a file or a file range from the service to a memory buffer using parallel requests.
ShareFileClient(const std::string &shareFileUrl, std::shared_ptr< Core::Credentials::TokenCredential > credential, const ShareClientOptions &options=ShareClientOptions())
Initialize a new instance of ShareFileClient using shared key authentication.
Azure::Response< Models::GetFileRangeListResult > GetRangeListDiff(std::string previousShareSnapshot, const GetFileRangeListOptions &options=GetFileRangeListOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Gets the list of valid range from the file within specified range that have changed since previousSha...
ListFileHandlesPagedResponse ListHandles(const ListFileHandlesOptions &options=ListFileHandlesOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Returns a sequence of the open handles on a directory or a file. Enumerating the handles may make mul...
Azure::Response< Models::SetFilePropertiesResult > SetProperties(const Models::FileHttpHeaders &httpHeaders, const Models::FileSmbProperties &smbProperties, const SetFilePropertiesOptions &options=SetFilePropertiesOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Sets the properties of the file, or resize a file specifying NewSize in options.
Azure::Response< Models::UploadFileFromResult > UploadFrom(const uint8_t *buffer, size_t bufferSize, const UploadFileFromOptions &options=UploadFileFromOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Creates a new file, or updates the content of an existing file. Updating an existing file overwrites ...
ForceCloseAllFileHandlesPagedResponse ForceCloseAllHandles(const ForceCloseAllFileHandlesOptions &options=ForceCloseAllFileHandlesOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Closes all handles opened on a file at the service.
static ShareFileClient CreateFromConnectionString(const std::string &connectionString, const std::string &shareName, const std::string &fileName, const ShareClientOptions &options=ShareClientOptions())
Create A ShareFileClient from connection string to manage a File Share File resource.
Azure::Response< Models::ForceCloseFileHandleResult > ForceCloseHandle(const std::string &handleId, const ForceCloseFileHandleOptions &options=ForceCloseFileHandleOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Closes a handle opened on a file at the service.
Azure::Response< Models::CreateFileHardLinkResult > CreateHardLink(const std::string &targetFile, const CreateHardLinkOptions &options=CreateHardLinkOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
NFS only. Creates a hard link to the file specified by path.
Azure::Response< Models::DeleteFileResult > Delete(const DeleteFileOptions &options=DeleteFileOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Deletes the file.
Azure::Response< Models::UploadFileFromResult > UploadFrom(const std::string &fileName, const UploadFileFromOptions &options=UploadFileFromOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Creates a new file, or updates the content of an existing file. Updating an existing file overwrites ...
StartFileCopyOperation StartCopy(std::string copySource, const StartFileCopyOptions &options=StartFileCopyOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Starts copy the file specified from source URI to the file this client points to.
Azure::Response< Models::UploadFileRangeFromUriResult > UploadRangeFromUri(int64_t destinationOffset, const std::string &sourceUri, const Azure::Core::Http::HttpRange &sourceRange, const UploadFileRangeFromUriOptions &options=UploadFileRangeFromUriOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Upload a range from the source URI to this file's specific range.
Azure::Response< Models::AbortFileCopyResult > AbortCopy(std::string copyId, const AbortFileCopyOptions &options=AbortFileCopyOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Aborts copying the file specified with the copy ID.
std::string GetUrl() const
Gets the file's primary URL endpoint.
Definition share_file_client.hpp:78
Azure::Response< Models::CreateFileResult > Create(int64_t fileSize, const CreateFileOptions &options=CreateFileOptions(), const Azure::Core::Context &context=Azure::Core::Context()) const
Creates the file.
ShareFileClient(const std::string &shareFileUrl, std::shared_ptr< StorageSharedKeyCredential > credential, const ShareClientOptions &options=ShareClientOptions())
Initialize a new instance of ShareFileClient using shared key authentication.
ShareLeaseClient allows you to manipulate Azure Storage leases on shares and files.
Definition share_lease_client.hpp:18
A long-running operation to copy a file.
Definition share_responses.hpp:725
Optional parameters for Azure::Storage::Files::Shares::ShareFileClient::AbortCopy.
Definition share_options.hpp:1036
Optional parameters for Azure::Storage::Files::Shares::ShareFileClient::ClearRange.
Definition share_options.hpp:1130
Optional parameters for Azure::Storage::Files::Shares::ShareFileClient::Create.
Definition share_options.hpp:875
Optional parameters for Azure::Storage::Files::Shares::ShareFileClient::Delete.
Definition share_options.hpp:921
Optional parameters for Azure::Storage::Files::Shares::ShareFileClient::Download.
Definition share_options.hpp:932
Optional parameters for Azure::Storage::Files::Shares::ShareFileClient::DownloadTo.
Definition share_options.hpp:1253
Optional parameters for Azure::Storage::Files::Shares::ShareFileClient::ForceCloseAllHandles.
Definition share_options.hpp:1239
Optional parameters for Azure::Storage::Files::Shares::ShareFileClient::ForceCloseHandle.
Definition share_options.hpp:1231
Optional parameters for Azure::Storage::Files::Shares::ShareFileClient::GetProperties.
Definition share_options.hpp:1047
Optional parameters for Azure::Storage::Files::Shares::ShareFileClient::GetRangeList.
Definition share_options.hpp:1184
Optional parameters for Azure::Storage::Files::Shares::ShareFileClient::ListHandles.
Definition share_options.hpp:1209
Standard HTTP properties supported files.
Definition rest_client.hpp:1597
The SMB related properties for the file.
Definition rest_client.hpp:1060
Optional parameters for Azure::Storage::Files::Shares::ShareFileClient::SetMetadata.
Definition share_options.hpp:1094
Optional parameters for Azure::Storage::Files::Shares::ShareFileClient::SetProperties.
Definition share_options.hpp:1058
Client options used to initialize share clients.
Definition share_options.hpp:265
Optional parameters for Azure::Storage::Files::Shares::ShareFileClient::StartCopy.
Definition share_options.hpp:954
Optional parameters for Azure::Storage::Files::Shares::ShareFileClient::UploadFrom.
Definition share_options.hpp:1287
Optional parameters for Azure::Storage::Files::Shares::ShareFileClient::UploadRangeFromUri.
Definition share_options.hpp:1148
Optional parameters for Azure::Storage::Files::Shares::ShareFileClient::UploadRange.
Definition share_options.hpp:1105